home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / COMMUNIC / 1572B.ZIP / KMT_IBM5.ZIP / MSSSET.ASM < prev   
Assembly Source File  |  1989-07-11  |  134KB  |  3,173 lines

  1.         NAME    mssset
  2. ; File MSSSET.ASM
  3. ; Set command module
  4. ; edit history:
  5. ; Last edit 3 Dec 1988
  6. ; 3 Dec 1988 Add ASSIGN command. Same as DEFINE except substitution variables
  7. ;  are expanded in the definition string, thus making a copy command.
  8. ; 21 Nov 1988 Version 2.32
  9. ; 20 Nov 1988 Let \%number items on DO MACRO arg1 arg2 ... accept curly braced
  10. ;  strings as individual "words."
  11. ; 12 Nov 1988 Check table space before opening a new Take file.
  12. ; 1 Nov 1988 Add SET SERVER TIMEOUT command.
  13. ; 5 Oct 1988 Remove script details from main STATUS display.
  14. ; 27 August 1988 Add dtrans.ebquot to retain default 8-bit quoting condition.
  15. ; 28 July 1988 Add ASK command.
  16. ; 17 July 1988 Correct Show Server status getsflg and add HOST to DISABLE
  17. ;  help message. Tnx to Terry Kennedy. [jrd]
  18. ; 1 July 1988 Version 2.31
  19. ; 15 May 1988 Add global status kstatus
  20. ; 8 April 1988 Move Take disk file buffers to Macro definition buffer and
  21. ;  name such Takes "<null>Tn" (n='1' to 'maxtak'). [jrd]
  22. ; 26 March 1988 Add global buffer subbuf and byte comand.cmper to permit
  23. ;  '\%x' style string substitution in commands. [jrd]
  24. ;  Comand.cmper non-zero allows phrase '\%n' to be read as a literal. [jrd]
  25. ; 20 March 1988 Add expanded Show command, allow macro name in Show Mac. [jrd]
  26. ; 9 Feb 1988 Add mode line status of on (owned by host). [jrd]
  27. ; 1 Jan 1988 version 2.30
  28.  
  29.         public setcom, status, baudprt, prmptr, dodef, stat0, statc
  30.         public setcpt, docom, shomac, dmpname, stkadr
  31.         public setrx, shorx, rxtable, shcom, shlog, shpro, shterm, shscpt
  32.         public shfile, srvdsa, srvena, srchkw, srchkb, shserv
  33.         public mcctab, takopen, takclos, ask, assign
  34.         include mssdef.h
  35.  
  36. braceop equ     7bh                     ; opening curly brace
  37. bracecl equ     7dh                     ; closing curly brace
  38. macmax  equ     50              ; max # of macros
  39. maketab MACRO                   ; Assembler Macro to make rxtable [jrd]
  40. cnt = 0
  41.         rept 256
  42.         db      cnt             ; initialize table to 0 .. 255
  43. cnt = cnt + 1
  44.         endm
  45.         db      0               ; table off (0) or on (1) indicator
  46. ENDM
  47. datas   segment public 'datas'
  48.         extrn   comand:byte, intake:byte, flags:byte, trans:byte
  49.         extrn   takadr:word, taklev:byte, inichk:byte, portval:word
  50.         extrn   curdsk:byte, setktab:byte, setkhlp:byte, dtrans:byte
  51.         extrn   spause:byte, filtst:byte, maxtry:byte, imxtry:byte
  52.         extrn   script:byte, denyflg:word, comptab:byte, termtb:byte
  53.         extrn   sloghnd:word, ploghnd:word, tloghnd:word, decbuf:byte
  54.         extrn   kstatus:word, errlev:byte, alrhms:byte, srvtmo:byte
  55.  
  56. kerm    db      'Kermit-MS>$'
  57. crlf    db       cr,lf,'$'
  58. crlfsp  db      cr,lf,' ',' ','$'       ; crlf space space
  59. eqs     db      ' = $'
  60. spaces  db      '    $'
  61. prmptr  dw      kerm                    ; pointer to prompt
  62. prm     db      60 dup (?)              ; Buffer for new prompt
  63. rdbuf   db      255 dup (?)             ; work space; room for macro def
  64.                                         ;  and for Status display line
  65. tempptr dw      0                       ; pointer into work buffer
  66. domacptr dw     0                       ; pointer to DO MAC string
  67.  
  68. min     dw      0
  69. max     dw      0
  70. numerr  dw      0
  71. numhlp  dw      0
  72. stflg   db      0               ; Says if setting SEND or RECEIVE parameter
  73. temp    dw      0
  74. temp1   dw      0                       ; Temporary storage
  75. temp2   dw      0                       ; Temporary storage
  76. deftemp dw      0
  77. shmcnt  dw      0
  78.  
  79. stent   struc                   ; structure for status information table sttab
  80. sttyp   dw      ?               ; type (actually routine to call)
  81. msg     dw      ?               ; message to print
  82. val2    dw      ?               ; needed value: another message, or tbl addr
  83. tstcel  dw      ?               ; address of cell to test, in data segment
  84. basval  dw      0               ; base value, if non-zero
  85. stent   ends
  86. ;;;;; Additional datas segment material is at the end of this file, to assist
  87. ;;;;; MASM 4 with out of symbol table space problems.
  88. datas   ends
  89.  
  90. code    segment public 'code'
  91.         extrn prserr:near, comnd:near, dobaud:near, cmblnk:near, locate:near
  92.         extrn prompt:near, coms:near, defkey:near, cwdir:near
  93.         extrn prtscr:near, getbaud:near, isfile:near, strlen:near
  94.         extrn strcpy:near, cnvlin:near, katoi:near, decout:near
  95.         extrn vts:near, vtstat:near, shomodem:near, setalrm:near
  96.  
  97.         assume  cs:code, ds:datas, es:nothing
  98.  
  99. ; DO defined macro command
  100. ; DO macname variable variable   also defines variables \%1, \%2, ...\%9
  101. DOCOM   PROC    NEAR
  102.         mov     dx,offset mcctab        ; table of macro defs
  103.         mov     bx,0                    ; help is table
  104.         mov     ah,cmkey                ; get key word (macro name)
  105.         call    comnd                   ; get pointer to keyword structure
  106.          ret
  107.          nop
  108.          nop
  109.         mov     comand.cmquiet,0        ; permit command echoing
  110.         mov     domacptr,bx             ; address of definition string
  111. ; note: remtab updates domacptr because substitutions many modify the table
  112.         mov     bx,offset decbuf        ; point to borrowed work buffer
  113.         mov     word ptr[bx],0          ; clear buffer
  114.         mov     dx,offset dohlp         ; help
  115.         mov     comand.cmblen,length rdbuf ; length of analysis buffer
  116.         mov     ah,cmtxt                ; get line of text, if any
  117.         call    comnd
  118.          ret
  119.          nop
  120.          nop
  121.         mov     al,ah
  122.         mov     ah,0
  123.         mov     deftemp,ax              ; save byte count of command args
  124.         cmp     al,0                    ; anything given?
  125.         je      docom9                  ; e = no, just do the macro
  126.         mov     word ptr rdbuf+3,' 1'   ; number of first variable
  127. docom8: mov     rdbuf,0                 ; clear length field, install \%x name
  128.         mov     word ptr rdbuf+1,'%\'   ; start with '\%1 '
  129.         mov     word ptr rdbuf+5,0      ; clear text field
  130.         mov     tempptr,offset rdbuf+5  ; pointer to location of found word
  131.         mov     ch,0                    ; make cx = 1 - 9
  132.         mov     cl,rdbuf+3              ; cx = word # of interest, for getwrd
  133.         sub     cl,'0'                  ; remove ascii bias
  134.         mov     si,offset decbuf        ; source = work buffer (borrowed)
  135.         call    getwrd                  ; get CX-th word from  work buf (1-9)
  136.         cmp     deftemp,0               ; length of word, was it found?
  137.         je      docom9                  ; e = no, end variable definition part
  138.         add     deftemp,4               ; count '\%n ' in command line length
  139.         call    dodecom                 ; add keyword+def using DEF MAC below
  140.          nop
  141.          nop
  142.          nop
  143.         inc     rdbuf+3                 ; inc number of variable in '\%n '
  144.         cmp     rdbuf+3,'9'
  145.         jbe     docom8                  ; do '1' through '9', if available
  146.  
  147.                                         ; DO the macro itself
  148. docom9: cmp     taklev,maxtak           ; room in take level?
  149.         jl      docom2                  ; l = yes, continue
  150.         mov     dx,offset ermes4        ; else complain
  151.         jmp     reterr
  152. docom2: inc     taklev                  ; increment take level
  153.         add     takadr,size takinfo
  154.         mov     bx,takadr               ; point to current buffer
  155.         mov     si,domacptr             ; address of macro definition string
  156.         mov     [bx].takbuf,si          ; remember in Take structure
  157.         mov     cl,[si]                 ; length of definition
  158.         mov     ch,0
  159.         inc     si                      ; point to actual definition
  160.         mov     [bx].taktyp,0ffh        ; flag as a macro
  161.         mov     [bx].takptr,si          ; point to beginning of def
  162.         mov     [bx].takcnt,cx          ; # of chars in buffer
  163.         jmp     rskp
  164. DOCOM   ENDP
  165.  
  166. ; Extract CX-th word (cx = 1-9) from buffer (DI). Enter with si = source
  167. ; string and tempptr pointing at destination. Returns deftemp (count) of
  168. ; transferred characters. Allow string in curly braces to exist as a word.
  169. ; Adjacent curly braced strings are separate "words":
  170. ;    {this is word-one}{this is word-two}word-three.
  171. ; All registers preserved.
  172. getwrd  proc    near
  173.         push    ax
  174.         push    cx
  175.         push    dx
  176.         push    si
  177.         push    di
  178.         push    es
  179.         push    ds
  180.         pop     es                      ; set es to datas segment
  181. getwr1: push    cx                      ; save word counter (1-9)
  182.         mov     deftemp,0               ; no bytes transferred yet
  183.         mov     di,tempptr              ; where to store word/string
  184.         mov     byte ptr [di],0         ; clear destination
  185.         mov     dx,si                   ; start looking here in work buf
  186.         call    strlen                  ; cx = remaining length of work buf
  187.         jcxz    getwr6                  ; z = nothing there, quit
  188. getwr2: lodsb
  189.         cmp     al,' '                  ; skip leading whitespace
  190.         loope   getwr2
  191.         dec     si                      ; return to break char
  192.                                         ; Parse curly brace delimited string
  193.                                         ; end with si after closing brace
  194.         mov     dl,0                    ; assume "opening brace" is a null
  195.         mov     dh,' '                  ; assume "closing brace" is a space
  196.         mov     cx,1                    ; we are at brace level 1
  197.         cmp     byte ptr [si],braceop   ; starting with a real opening brace?
  198.         jne     getwr3                  ; ne = no
  199.         inc     si                      ; skip opening brace
  200.         mov     dl,braceop              ; opening brace (we count them up)
  201.         mov     dh,bracecl              ; closing brace (we count them down)
  202. getwr3: cld                             ; search forward
  203.         lodsb                           ; read a char
  204.         stosb                           ; store in output buffer
  205.         cmp     al,0                    ; at end of text?
  206.         jne     getwr3a                 ; ne = no
  207.         dec     si                      ; stay at null terminator
  208.         dec     di
  209.         jmp     short getwr6            ; we are done with this "word"
  210. getwr3a:inc     deftemp                 ; count copied char
  211.         cmp     al,dl                   ; an opening brace?
  212.         jne     getwr4                  ; ne = no
  213.         inc     cx                      ; yes, increment brace level
  214.         jmp     short getwr3            ;  and continue scanning
  215.  
  216. getwr4: cmp     al,dh                   ; closing brace?
  217.         jne     getwr3                  ; ne = no, continue scanning
  218.         dec     cx                      ; yes, decrement brace level
  219.         cmp     byte ptr [si],0         ; have we just read the last char?
  220.         jne     getwr5                  ; no, continue scanning
  221.         mov     cx,0                    ; yes, this is the closing brace
  222. getwr5: cmp     cx,0                    ; at level 0?
  223.         jne     getwr3                  ; ne = no, #opening <> #closing braces
  224.         mov     byte ptr [di-1],0       ; plant terminator on closing brace
  225.         dec     deftemp                 ; do not count closing brace
  226.  
  227. getwr6: pop     cx                      ; recover word counter
  228.         mov     byte ptr [di],0
  229.         jcxz    getwrx                  ; just in case
  230.         loop    getwr1                  ; do until desired word is copied
  231. getwrx: pop     es
  232.         pop     di
  233.         pop     si
  234.         pop     dx
  235.         pop     cx
  236.         pop     ax
  237.         ret
  238. getwrd  endp
  239.  
  240. ; DEFINE and ASSIGN macro commands
  241. ; Data structures comments. Macro name is stored in table mcctab as if we
  242. ; had used macro mkeyw, such as       mkeyw 'mymac',offset my_definition.
  243. ; In detail:    db      length of name
  244. ;               db      'name'
  245. ;               db      '$'
  246. ;               dw      offset of definition string
  247. ; Mcctab begins with a byte holding the number of macros in the table; one,
  248. ;  IBM, is established at assembly time. Mcctab is 10*macmax bytes long.
  249. ; Pointer mccptr holds the offset of the next free byte in mcctab.
  250. ; Definition strings are stored in table macbuf as
  251. ;               db      length of definition string below
  252. ;               db      'definition string'
  253. ; Pointer macptr holds the offset of the next free byte in macbuf. Macbuf
  254. ; is nominally 100*macmax bytes long.
  255. ; A new definition is read into buffer rdbuf+1, where byte rdbuf is reserved
  256. ;  to hold the length of the macro's name during intermediate processing.
  257. ; If the definition is absent then the macro is removed from the tables.
  258. ; Rewritten 13 June 1987 [jrd]
  259. ;
  260. ; ASSIGN is equivalent to DEFINE, except in the definition string substitution
  261. ; variable names are expanded to their definitions. This becomes a copy cmd.
  262. ; DEFINE does not expand substitution variables.
  263.  
  264. ASSIGN  PROC    NEAR
  265.         mov     temp,0                  ; flag command as ASSIGN, vs DEFINE
  266.         jmp     dodefcom                ; common code
  267. ASSIGN  ENDP
  268.  
  269. DODEF   PROC    NEAR
  270.         mov     temp,1                  ; flag command as DEFINE, vs ASSIGN
  271. DODEFCOM:
  272.         mov     comand.cmper,1          ; do not react to '\%' in macro name
  273.         mov     ah,cmfile
  274.         mov     dx,offset rdbuf+1       ; buffer for macro name
  275.         mov     word ptr rdbuf,0
  276.         mov     bx,offset macmsg
  277.         call    comnd                   ; get macro name
  278.          ret
  279.          nop
  280.          nop
  281.         cmp     ah,0                    ; null entry?
  282.         jne     dodef1                  ; ne = no
  283.         mov     dx,offset ermes6        ; more parameters needed
  284.         jmp     reterr
  285.  
  286. dodef1: mov     bx,dx                   ; updated pointer
  287.         mov     byte ptr [bx-1],' '     ; replace null with space separator
  288.         mov     word ptr [bx],0         ; terminator, in case no command
  289.         mov     ax,temp                 ; get ASSIGN/DEFINE flag
  290.         mov     comand.cmper,al         ; react (DEF) to '\%' in definition
  291.         mov     ah,cmtxt                ; get a line of text
  292.         mov     dx,offset macmsg
  293.         mov     comand.cmblen,length rdbuf ; our buffer length
  294.         sub     comand.cmblen,al        ; minus part used
  295.         dec     comand.cmblen           ; space separator
  296.         call    comnd                   ; get macro name
  297.          ret
  298.          nop
  299.          nop
  300.         sub     bx,offset rdbuf         ; length of command line
  301.         dec     bx                      ; minus count byte
  302.         mov     deftemp,bx              ; save length of command line
  303. ;;      jmp     dodecom                 ; common code below
  304. DODEF   ENDP
  305.                                         ; DODECOM called by DO mac above
  306. ; accepts rdbuf+1 et seq = <macro name><spaces><arg><spaces><arg> ...
  307. ; byte rdbuf computed here as length of keyword
  308. DODECOM PROC    NEAR
  309.         push    si                      ; macro name in rdbuf+1 et seq
  310.         push    di                      ; cmd line length in deftemp
  311.         push    es
  312.         push    ds                      ; address data segment
  313.         pop     es
  314.         mov     cx,deftemp              ; cmd line len, cx = running counter
  315.         mov     rdbuf,0                 ; number of chars in keyword so far
  316.                                         ; uppercase the keyword, look for end
  317.         mov     si,offset rdbuf+1       ; point at macro name text
  318.         cld                             ; strings go forward
  319. dode2:  lodsb                           ; get a byte, dec cx
  320.         cmp     al,'a'                  ; map lower case to upper
  321.         jb      dode3
  322.         cmp     al,'z'
  323.         ja      dode3
  324.         sub     al,'a'-'A'
  325.         mov     [si-1],al               ; uppercase if necessary
  326. dode3:  inc     rdbuf                   ; increment char count of keyword
  327.         cmp     al,' '                  ; is this the break character?
  328.         loopne  dode2                   ; no, loop thru rest of word
  329.         jne     dode4                   ; ne = did not end with break char
  330.         dec     rdbuf                   ; yes, don't count in length
  331. dode4:  push    di
  332.         mov     di,offset rdbuf         ; point at mac name length byte
  333.         call    remtab                  ; remove any duplicate keyword
  334.         pop     di
  335.         jcxz    dode6                   ; cx = 0 means no keyword
  336.                                 ; check for free space for keyword and string
  337.         mov     al,rdbuf                ; keyword text length
  338.         add     al,4                    ; plus overhead bytes
  339.         xor     ah,ah
  340.         add     ax,mccptr               ; add to free space pointer
  341.         cmp     ax,offset mcctab+mcclen ; enough room for name?
  342.         jb      dode5                   ; b = yes
  343.         mov     dx,offset ermes1        ; too many macro names
  344.         pop     es
  345.         pop     di
  346.         pop     si
  347.         jmp     reterr
  348. dode5:
  349.         mov     di,si                   ; si = source address
  350.         add     di,cx                   ; length of string
  351.         dec     di                      ; omit null terminator
  352.         std
  353.         mov     al,' '                  ; scan off trailing spaces
  354.         repe    scasb
  355.         add     di,2                    ; backup to terminator slot
  356.         cld
  357.         mov     byte ptr [di],0         ; plant new terminator
  358.         mov     dx,si
  359.         call    strlen                  ; get new length into cx
  360.  
  361.         mov     di,si                   ; scan after keyword name
  362.         mov     al,' '                  ; remove leading spaces in string
  363.         repe    scasb
  364.         je      dode6                   ; e = all spaces
  365.         inc     cx                      ; offset auto decrement of rep
  366.         dec     di                      ; offset auto increment of rep
  367.  
  368.         mov     si,di                   ; point to start of string text
  369.         mov     dx,di                   ; source of definition text
  370.         call    strlen                  ; get length of string into cx
  371.         mov     ax,cx                   ; length of string
  372.         mov     deftemp,cx              ; remember it here
  373.         inc     ax                      ; plus its count byte
  374.         add     ax,macptr               ; plus free space pointer
  375.         cmp     ax,offset macbuf+maclen ; enough room for definition string?
  376.         jb      dode7                   ; b = yes
  377.         pop     es
  378.         pop     di
  379.         pop     si
  380.         mov     dx,offset ermes2        ; no room for definition
  381.         jmp     reterr
  382. dode6:  pop     es
  383.         pop     di
  384.         pop     si
  385.         jmp     rskp
  386.                                         ; install new keyword in mcctab
  387. dode7:  cmp     deftemp,0               ; deftemp = length of definition
  388.         je      dode10                  ; e = no def, exit now
  389.         mov     bx,offset mcctab
  390.         mov     dx,offset rdbuf         ; count byte + name string
  391.         call    addtab
  392.                         ; copy definition into buffer, changing commas to CRs
  393.         mov     di,macptr               ; free space in string buffer
  394.         mov     cx,deftemp              ; length of definition string
  395.         mov     byte ptr[di],cl         ; store length of string
  396.         inc     di                      ; skip over count byte
  397. dode8:  lodsb                           ; get a byte
  398.         cmp     al,','                  ; comma?
  399.         jne     dode9                   ; no, keep going
  400.         mov     al,cr                   ; else replace with cr
  401. dode9:  stosb
  402.         loop    dode8                   ; keep copying
  403.         mov     macptr,di               ; update free ptr
  404. dode10: pop     es
  405.         pop     di
  406.         pop     si
  407.         jmp     rskp
  408. DODECOM ENDP
  409.  
  410. ; ASK <variable or macro name> <prompt string>
  411. ; Defines indicated variable/macro with text from user at keyboard or pipe
  412. ; (but not from a Take/macro). Prompt string is required.       [jrd]
  413. ASK     PROC    NEAR
  414.         mov     dx,offset rdbuf+1       ; point to work buffer
  415.         mov     word ptr rdbuf,0
  416.         mov     bx,offset askhlp1       ; help
  417.         mov     comand.cmper,1          ; do not expand variable name
  418.         mov     ah,cmfile               ; get variable name
  419.         call    comnd
  420.          jmp    r
  421.          nop
  422.         cmp     ah,0                    ; anything given?
  423.         jne     ask2                    ; ne = yes
  424.         mov     dx,offset ermes6        ; more parameters needed
  425.         jmp     reterr
  426.  
  427. ask2:   xchg    ah,al
  428.         mov     ah,0
  429.         mov     bx,offset rdbuf+1       ; start of name
  430.         add     bx,ax                   ; plus length of variable name
  431.         mov     byte ptr [bx],' '       ; put space separator after name
  432.         inc     ax                      ; count space
  433.         mov     temp,ax                 ; remember length here
  434.                                         ; get ASK command prompt string
  435.         inc     bx                      ; put prompt string here
  436.         mov     byte ptr [bx],0         ; safety terminator
  437.         mov     dx,offset askhlp2
  438.         mov     comand.cmblen,127       ; our buffer length
  439.         sub     comand.cmblen,al        ;  minus part used above
  440.         mov     ah,cmtxt                ; get prompt string
  441.         call    comnd
  442.          jmp    r
  443.          nop
  444.         cmp     ah,0                    ; anything given?
  445.         jne     ask4                    ; ne = yes
  446.         mov     dx,offset ermes6        ; more parameters needed
  447.         jmp     reterr
  448.  
  449. ask4:   mov     ax,takadr               ; we could be in a macro or Take file
  450.         mov     temp2,ax                ; save Take address
  451.         mov     al,taklev
  452.         mov     ah,0
  453.         mov     temp1,ax                ; and Take level
  454.         mov     dx,size takinfo         ; bytes for each current Take
  455.         mul     dx                      ; times number of active Take/macros
  456.         sub     takadr,ax               ; clear Take address as if no
  457.         mov     taklev,0                ;  Take/macro were active so that
  458.                                         ;  user input is from kbd or pipe
  459.         mov     word ptr [bx],'$ '      ; printing terminator for prompt
  460.         mov     dx,offset rdbuf+1
  461.         add     dx,temp                 ; prompt for input string
  462.         mov     si,dx
  463.         mov     di,offset rdbuf+129     ; temporary destination
  464.         push    dx                      ; save source
  465.         call    cnvlin                  ; parse backslash numbers etc
  466.         pop     dx                      ; destination is old source location
  467.         mov     si,di                   ; copy back to lower part of rdbuf
  468.         add     di,cx                   ; go to null terminator
  469.         mov     word ptr [di],'$ '      ; dollar sign/space for DOS printing
  470.         mov     byte ptr [di+2],0
  471.         mov     di,dx
  472.         call    strcpy
  473.         call    prompt                  ; buf = <var name>< ><prompt string>
  474.         mov     bx,offset rdbuf+129     ; use this buffer for raw user input
  475.         mov     word ptr [bx],0         ; insert terminator
  476.         mov     dx,offset askhlp3       ; help for user input
  477.         mov     ah,cmtxt                ; read user's input string
  478.         call    comnd
  479.          jmp    ask9                    ; exit now on ~C from user
  480.          nop
  481.         mov     cl,ah                   ; length of entry
  482.         mov     ch,0
  483.         jcxz    ask8                    ; z = empty
  484.         mov     si,offset rdbuf+129     ; source string
  485.         mov     di,offset rdbuf+1       ; start of variable name
  486.         add     di,temp                 ; di points to final user string
  487.         push    es                      ; save es
  488.         push    ds
  489.         pop     es                      ; set es to datas segment
  490.         cld
  491. ask6:   lodsb                           ; read original user string char
  492.         cmp     al,','                  ; literal comma?
  493.         jne     ask7                    ; ne = no
  494.         mov     ax,'{\'                 ; yes. Replace literal comma
  495.         stosw                           ;  with numerical equivalent \{44}
  496.         mov     ax,'44'                 ;  to permit commas in macro def
  497.         stosw
  498.         add     temp,4
  499.         mov     al,'}'
  500. ask7:   stosb                           ; store string character
  501.         inc     temp                    ; length of <variable>< ><user string>
  502.         loop    ask6
  503.         pop     es
  504. ask8:   mov     ax,temp                 ; length of <variable>< ><user string>
  505.         mov     deftemp,ax              ; put here for dodecom usage
  506.         mov     ax,temp2
  507.         mov     takadr,ax               ; restore Take address
  508.         mov     ax,temp1
  509.         mov     taklev,al               ; restore Take level
  510.         jmp     DODECOM                 ; define the macro/variable and exit
  511.  
  512. ask9:   mov     ax,temp2                ; failure path
  513.         mov     takadr,ax               ; restore Take address
  514.         mov     ax,temp1
  515.         mov     taklev,al               ; restore Take level
  516.         ret                             ; return command failure
  517. ASK     ENDP
  518.  
  519. ; Open a disk based Take file buffer. Define macro named "<null>T<'taklev'>",
  520. ; allocate 128 byte uninitiated buffer in mcctab for disk i/o. Leading null
  521. ; is to prevent user from employing the same name accidentally. Return offset
  522. ; of buffer in [takadr].takbuf and set [takadr].takptr pointing to it.
  523. ; Return carry clear for success, carry set for failure.
  524.  
  525. TAKOPEN PROC    NEAR
  526.         push    ax
  527.         push    bx
  528.         push    dx
  529.         push    di
  530.         mov     dx,offset ermes2        ; says no room for defintions
  531.         mov     ax,dmasiz+1             ; count byte plus length of buffer
  532.         add     ax,macptr               ; plus free space pointer
  533.         cmp     ax,offset macbuf+maclen ; enough room for definition string?
  534.         jae     takopen1                ; ae = no, complain
  535.         cmp     taklev,maxtak           ; room in take level?
  536.         jl      takopen2                ; l = yes, continue
  537.         mov     dx,offset ermes4        ; say too many Take files
  538. takopen1:mov    ah,prstr
  539.         int     dos
  540.         pop     di
  541.         pop     dx
  542.         pop     bx
  543.         pop     ax
  544.         stc                             ; set carry for failure
  545.         ret
  546.  
  547. takopen2:inc    taklev                  ; next Take
  548.         add     takadr,size takinfo     ; pointer to Take structure
  549.         mov     rdbuf,3                 ; length of name, 3 bytes <null>Tn
  550.         mov     rdbuf+1,0
  551.         mov     rdbuf+2,'T'             ; name of <null>Tn
  552.         mov     al,taklev               ; Take level digit
  553.         add     al,'0'                  ; add ascii bias
  554.         mov     rdbuf+3,al              ; last of the name
  555.         mov     di,offset rdbuf         ; pointer for remtab
  556.         call    remtab                  ; remove possible old macro
  557.         mov     bx,offset mcctab        ; table to use
  558.         mov     dx,offset rdbuf         ; count and mac name to enter
  559.         call    addtab                  ; returns string pointer in macptr
  560.         mov     di,macptr
  561.         add     macptr,dmasiz+1         ; set new free byte into pointer
  562.         mov     byte ptr [di],dmasiz    ; string length (128 bytes)
  563.         mov     bx,takadr               ; pointer to Take structure
  564.         mov     [bx].takbuf,di          ; offset of Take buffer
  565.         inc     di                      ; skip count byte in takbuf
  566.         mov     [bx].takptr,di          ; init pointer to definition itself
  567.         pop     di
  568.         pop     dx
  569.         pop     bx
  570.         pop     ax
  571.         clc                             ; carry clear for success
  572.         ret
  573. TAKOPEN ENDP
  574.  
  575. ; Close Take file. Enter at Take level to be closed. Removes pseudo macro
  576. ; name <null>Tn and its buffer, closes disk file, pops Take level.
  577.  
  578. TAKCLOS PROC    NEAR
  579.         cmp     taklev,0                ; anything to close?
  580.         jle     takclo2                 ; le = no
  581.         push    ax
  582.         push    bx
  583.         mov     bx,takadr               ; point to Take structure
  584.         cmp     [bx].taktyp,0feh        ; disk file (vs macro)?
  585.         jne     takclo1                 ; ne = no, no buffer to deallocate
  586.         mov     rdbuf,3                 ; length of name
  587.         mov     rdbuf+1,0
  588.         mov     rdbuf+2,'T'             ; name of <null>Tn
  589.         mov     al,taklev               ; Take level digit
  590.         add     al,'0'                  ; add ascii bias
  591.         mov     rdbuf+3,al              ; last of the name
  592.         push    di
  593.         mov     di,offset rdbuf         ; pointer for remtab
  594.         call    remtab                  ; remove possible old macro
  595.         pop     di
  596.         mov     bx,[bx].takhnd          ; get file handle
  597.         mov     ah,close2               ; close file
  598.         int     dos
  599.                                         ; both disk and macro Takes
  600. takclo1:dec     taklev                  ; pop Take level
  601.         mov     ah,taklev               ; get current Take level
  602.         mov     intake,ah               ; remember here for later callers
  603.         sub     takadr,size takinfo     ; get previous Take's address
  604.         pop     bx
  605.         pop     ax
  606. takclo2:ret
  607. TAKCLOS ENDP
  608.  
  609. ; add an entry to a keyword table
  610. ; enter with bx = table address, dx = ptr to new entry, macptr = string offset,
  611. ; mccptr = offset of free bytes in table mcctab.
  612. ; no check is made to see if the entry fits in the table.
  613. addtab  proc    near
  614.         push    cx
  615.         push    si
  616.         push    es
  617.         cld
  618.         mov     ax,ds
  619.         mov     es,ax           ; address data segment
  620.         mov     bp,bx           ; remember where tbl starts
  621.         mov     cl,[bx]         ; pick up length of table
  622.         mov     ch,0
  623.         inc     bx              ; point to actual table
  624.         jcxz    addta4          ; cx = 0 if table is presently empty
  625.  
  626. addta1: push    cx              ; preserve count
  627.         mov     si,dx           ; point to entry
  628.         lodsb                   ; get length of new entry
  629.         mov     cl,[bx]         ; and length of table entry
  630.         mov     ah,0            ; assume they're the same size
  631.         cmp     al,cl           ; are they the same?
  632.         lahf                    ; remember result of comparison
  633.         jae     addta2          ; is new smaller? no, use table length
  634.         mov     cl,al           ; else use length of new entry
  635. addta2: mov     ch,0
  636.         lea     di,[bx+1]       ; point to actual keyword
  637.         repe    cmpsb           ; compare strings
  638.         pop     cx              ; restore count
  639.         jb      addta4          ; below, insert before this one
  640.         jne     addta3          ; not below or same, keep going
  641.         sahf                    ; same. get back result of length comparison
  642.         jb      addta4          ; if new len is smaller, insert here
  643.         jne     addta3          ; if not same size, keep going
  644.         mov     si,bx           ; else this is where entry goes
  645.         jmp     short addta6    ; no insertion required
  646. addta3: mov     al,[bx]
  647.         mov     ah,0
  648.         add     bx,ax           ; skip this entry
  649.         add     bx,4            ; len + $ + value
  650.         loop    addta1          ; and keep looking
  651. addta4: mov     si,bx           ; this is first location to move
  652.         mov     di,bx
  653.         inc     ds:byte ptr [bp] ; remember we're adding one
  654.         jcxz    addta6          ; no more entries, forget this stuff
  655.         mov     bh,0            ; this stays 0
  656. addta5: mov     bl,[di]         ; get length
  657.         lea     di,[bx+di+4]    ; end is origin + length + 4 for len, $, value
  658.         loop    addta5          ; loop thru remaining keywords
  659.         mov     cx,di
  660.         sub     cx,si           ; compute # of bytes to move
  661.         push    si              ; preserve loc for new entry
  662.         mov     si,di           ; first to move is last
  663.         dec     si              ; minus one
  664.         mov     di,dx           ; new entry
  665.         mov     bl,[di]         ; get length
  666.         lea     di,[bx+si+4]    ; dest is source + length of new + 4
  667.         std                     ; move backward
  668.         rep     movsb           ; move the table down (compress it)
  669.         cld                     ; put flag back
  670.         pop     si
  671. addta6: mov     di,si           ; this is where new entry goes
  672.         mov     si,dx           ; this is where it comes from
  673.         mov     cl,[si]         ; length
  674.         mov     ch,0
  675.         add     cx,1            ; include count byte
  676.         add     mccptr,cx       ; update free space pointer: cnt+name
  677.         add     mccptr,3        ; plus '$' and pointer to string
  678.         rep     movsb           ; stick it in
  679.         mov     al,'$'          ; add printing terminator
  680.         stosb
  681.         mov     ax,macptr       ; and string offset
  682.         stosw
  683.         pop     es
  684.         pop     si
  685.         pop     cx
  686.         ret
  687. addtab  endp
  688.  
  689. ; If new keyword matches an existing one then remove existing keyword,
  690. ; its string definition, compress tables mcctab and macbuf, readjust string
  691. ; pointers for each macro name, reduce number of macro table entries by one.
  692. ; DO MAC pointer (domacptr) is adjusted to follow deletion.
  693. ; Enter with DI pointing at length byte of mac name (followed by mac name).
  694. ; Otherwise, exit with no changes.  13 June 1987 [jrd]
  695. remtab  proc    near
  696.         push    ax
  697.         push    bx
  698.         push    cx
  699.         push    si
  700.         push    di
  701.         mov     bx,offset mcctab+1      ; table of macro keywords
  702.         mov     temp,0                  ; temp = current keyword
  703.         cmp     byte ptr mcctab,0       ; any macros defined?
  704.         jne     remta1                  ; ne = yes
  705.         jmp     remtax                  ; else exit now
  706. remta1:                                 ; match table keyword and text word
  707.         mov     si,di                   ; pointer to user's cnt+name
  708.         mov     cl,[si]                 ; length of user's macro name
  709.         xor     ch,ch
  710.         inc     si                      ; point to new macro name
  711.         cmp     cl,[bx]                 ; compare length vs table keyword
  712.         jne     remta4                  ; ne = not equal lengths, try another
  713.         push    si                      ; lengths match, how about spelling?
  714.         push    bx
  715.         inc     bx                      ; point at start of keyword
  716. remta2: mov     ah,[bx]                 ; keyword char
  717.         mov     al,[si]                 ; new text char
  718.         cmp     al,ah                   ; test characters
  719.         jne     remta3                  ; ne = no match
  720.         inc     si                      ; move to next char
  721.         inc     bx
  722.         loop    remta2                  ; loop through entire length
  723. remta3: pop     bx
  724.         pop     si
  725.         jcxz    remta6                  ; z: cx = 0, exit with match;
  726.                                         ;  else select next keyword
  727. remta4: inc     temp                    ; number of keyword to test next
  728.         mov     cx,temp
  729.         cmp     cl,mcctab               ; all done? Recall, temp starts at 0
  730.         jb      remta5                  ; b = not yet
  731.         jmp     remtax                  ; exhausted search, unsuccessfully
  732. remta5: mov     al,[bx]                 ; cnt (keyword length from macro)
  733.         xor     ah,ah
  734.         add     ax,4                    ; skip over '$' and two byte value
  735.         add     bx,ax                   ; bx = start of next keyword slot
  736.         jmp     remta1                  ; do another comparison
  737.                                         ; new name already present as a macro
  738. remta6: cld                             ; clear macro string and macro name
  739.         push    ds
  740.         pop     es                      ; set es to datas segment
  741.         mov     temp,bx                 ; save ptr to found keyword
  742.         mov     al,[bx]                 ; cnt (keyword length of macro)
  743.         xor     ah,ah
  744.         add     ax,2                    ; skip cnt and '$'
  745.         add     bx,ax                   ; point to string offset field
  746.         add     ax,2                    ; count offset field bytes
  747.         sub     mccptr,ax               ; readjust free space ptr for names
  748.         push    bx
  749.         mov     bx,[bx]
  750.         mov     temp1,bx                ; temp1 = offset of old string
  751.         mov     al,[bx]                 ; length of old string
  752.         xor     ah,ah
  753.         inc     ax                      ; plus its count byte
  754.         mov     temp2,ax                ; save here
  755.         pop     bx
  756.                                         ; clear keyword table mcctab
  757.         add     bx,2                    ; compute source = next keyword
  758.         mov     si,bx                   ; address of next keyword
  759.         mov     di,temp                 ; address of found keyword
  760.         mov     cx,offset mcctab+mcclen ; address of buffer end
  761.         sub     cx,si                   ; amount to move
  762.         jcxz    remtax                  ; cx = 0 means none
  763.         rep     movsb                   ; move down keywords (deletes current)
  764.                                         ; revise other string offsets
  765.         mov     si,offset mcctab        ; table of string offsets
  766.         inc     si                      ; skip count byte
  767.         mov     cl,mcctab               ; current number of table entries
  768.         xor     ch,ch
  769.         dec     mcctab                  ; one less keyword
  770.         mov     dx,temp1                ; address of old string
  771. remta7: mov     al,[si]                 ; cnt of first keyword
  772.         add     al,2                    ; plus cnt and '$'
  773.         xor     ah,ah
  774.         add     si,ax                   ; look at string offset
  775.         cmp     dx,[si]                 ; old address vs this string
  776.         ja      remta8                  ; a = address not affected
  777.         mov     ax,temp2                ; size of old string
  778.         sub     [si],ax                 ; adjust offset downward
  779. remta8: add     si,2                    ; point to next table entry
  780.         loop    remta7
  781.         cmp     dx,domacptr             ; DO <macro> definition affected?
  782.         ja      remta8a                 ; a = no (occurs before removal)
  783.         mov     ax,temp2                ; get length being removed from table
  784.         sub     domacptr,ax             ; revise pointer downward also
  785. remta8a:mov     cl,taklev               ; consider all Take files
  786.         mov     ch,0
  787.         jcxz    remta9                  ; z = no active Take file
  788.                                         ; revise Take file def pointers
  789.         mov     bx,takadr               ; Take structure
  790. remta8b:mov     ax,[bx].takbuf          ; pointer to definition
  791.         cmp     dx,ax                   ; is this structure affected?
  792.         ja      remta8d                 ; a = no
  793.         mov     ax,temp2                ; length being removed from table
  794.         sub     [bx].takbuf,ax          ; adjust string structure downward
  795.         sub     [bx].takptr,ax          ; ditto for active read pointer
  796. remta8d:sub     bx,size takinfo         ; preceeding Take file
  797.         loop    remta8b
  798.                                         ; remove old string
  799. remta9: mov     di,temp1                ; address of old string = destination
  800.         mov     ax,temp2                ; size of old string field
  801.         mov     si,di
  802.         add     si,ax                   ; plus length: source = next string
  803.         sub     macptr,ax               ; readjust top of buf free string ptr
  804.         mov     cx,offset macbuf+maclen ; end of buffer
  805.         sub     cx,si                   ; number of bytes to move
  806.         jcxz    remtax                  ; cx = 0 means none
  807.         rep     movsb                   ; move old strings (garbage collect)
  808. remtax: pop     di
  809.         pop     si
  810.         pop     cx
  811.         pop     bx
  812.         pop     ax
  813.         ret
  814. remtab  endp
  815.  
  816. ; Common Get keyword + Get Confirm sequence. Call with dx = keyword table,
  817. ; bx = help message offset. Returns result in BX. Modifies AX, BX and temp.
  818. ; Returns rskp if sucessful or ret if failure. Used in many places below.
  819. keyend  proc    near
  820.         mov     ah,cmkey
  821.         call    comnd
  822.          ret
  823.          nop
  824.          nop
  825.         mov     temp,bx
  826.         mov     ah,cmcfm
  827.         call    comnd
  828.          ret
  829.          nop
  830.          nop
  831.         mov     bx,temp
  832.         jmp     rskp
  833. keyend  endp
  834.  
  835. srvdsa  proc    near                    ; DISABLE Server commands
  836.         mov     dx,offset srvdetab
  837.         mov     bx,offset sdshlp
  838.         call    keyend
  839.          ret
  840.          nop
  841.          nop
  842.         or      denyflg,bx              ; turn on bit (deny) for that item
  843.         jmp     rskp                    ; return successfully
  844. srvdsa  endp
  845.  
  846. srvena  proc    near                    ; ENABLE Server commands
  847.         mov     dx,offset srvdetab      ; keyword table
  848.         mov     bx,offset sdshlp        ; help on keywords
  849.         call    keyend
  850.          ret
  851.          nop
  852.          nop
  853.         not     bx                      ; invert bits
  854.         and     denyflg,bx              ; turn off (enable) selected item
  855.         jmp     rskp
  856. srvena  endp
  857.  
  858.  
  859. ; This is the SET command
  860. ; Called analyzers return rskp for success, else ret for failure
  861. SETCOM  PROC    NEAR                    ; Dispatch all SET commands from here
  862.         mov     kstatus,0               ; global status, success
  863.         mov     dx,offset settab        ; Parse a keyword from the set table
  864.         mov     bx,offset sethlp
  865.         mov     ah,cmkey
  866.         call    comnd
  867.          ret
  868.          nop
  869.          nop
  870.         jmp     bx                      ; execute analyzer routine
  871.                                         ; returns rskp for success, else ret
  872. SETCOM  endp
  873.  
  874. ;   SET BAUD or SET SPEED
  875.  
  876. BAUDST  PROC    NEAR
  877.         mov     dx,offset bdtab
  878.         mov     bx,0
  879.         call    keyend
  880.          ret
  881.          nop
  882.          nop
  883.         mov     si,portval
  884.         mov     ax,[si].baud            ; Remember original value
  885.         mov     [si].baud,bx            ; Set the baud rate
  886.         call    dobaud                  ; Use common code
  887.         jmp     rskp
  888. BAUDST  ENDP
  889.  
  890. ; SET BELL on or off
  891.  
  892. BELLST  PROC    NEAR
  893.         mov     dx,offset ontab
  894.         mov     bx,0
  895.         call    keyend
  896.          ret
  897.          nop
  898.          nop
  899.         mov     flags.belflg,bl
  900.         jmp     rskp
  901. BELLST  ENDP
  902.  
  903. ; SET BLOCK-CHECK
  904.  
  905. BLKSET  PROC    NEAR
  906.         mov     dx,offset blktab
  907.         mov     bx,0
  908.         call    keyend
  909.          ret
  910.          nop
  911.          nop
  912.         mov     trans.chklen,bl         ; Use this char as the handshake
  913.         mov     inichk,bl               ; Save here too
  914.         jmp     rskp
  915. BLKSET  ENDP
  916.  
  917. ; SET COUNTER number    for script IF COUNTER number <command>
  918. TAKECTR PROC    NEAR
  919.         mov     min,0                   ; get decimal char code
  920.         mov     max,65535               ; range is 0 to 65535 decimal
  921.         mov     numhlp,offset takchlp   ; help message
  922.         mov     numerr,0                ; error message
  923.         call    num0                    ; convert number, return it in ax
  924.         jc      takect2                 ; c = error
  925.         mov     temp,ax                 ; recover numerical code
  926.         mov     ah,cmcfm
  927.         call    comnd                   ; Get a confirm
  928.          ret                            ; Didn't get a confirm
  929.          nop
  930.          nop
  931.         mov     ax,temp                 ; recover bx
  932.         cmp     taklev,0                ; in a Take file?
  933.         je      takect4                 ; e = no
  934.         push    bx
  935.         mov     bx,takadr
  936.         mov     [bx].takctr,ax          ; set COUNT value
  937.         pop     bx
  938. takect2:jmp     rskp
  939. takect4:mov     dx,offset takcerr       ; say must be in Take file
  940.         jmp     reterr                  ; display msg and jmp rskp
  941. TAKECTR ENDP
  942.  
  943. ; SET DEBUG {OFF | ON | SESSSION | PACKETS}
  944.  
  945. DEBST   PROC       NEAR
  946.         mov     dx,offset debtab
  947.         mov     bx,offset debhlp
  948.         call    keyend
  949.          ret
  950.          nop
  951.          nop
  952.         or      flags.debug,bl          ; set the mode, except for Off
  953.         cmp     bx,0                    ; OFF?
  954.         jne     deb0                    ; ne = no
  955.         mov     flags.debug,0           ; Set the DEBUG flags off
  956. deb0:   jmp     rskp
  957. DEBST   ENDP
  958.  
  959. ; SET DESTINATION   of incoming files
  960.  
  961. DESSET  PROC    NEAR
  962.         mov     dx,offset destab
  963.         mov     bx,0
  964.         call    keyend
  965.          ret
  966.          nop
  967.          nop
  968.         mov     flags.destflg,bl        ; Set the destination flag
  969.         cmp     bl,2                    ; Is dest the screen?
  970.         jne     desa                    ; No, then done
  971.         mov     flags.xflg,1            ; Remember it here
  972.         jmp     rskp
  973. desa:   mov     flags.xflg,0            ; Don't write to screen
  974.         jmp     rskp
  975. DESSET  ENDP
  976.  
  977. ; SET DEFAULT-DISK    for sending/receiving, etc
  978. ; See cwdir in file mssker
  979.  
  980. ; SET DELAY seconds   Used only for SEND command in local mode
  981. SETDELY PROC    NEAR
  982.         mov     min,0                   ; smallest acceptable value
  983.         mov     max,63                  ; largest acceptable value
  984.         mov     numhlp,offset delyhlp   ; help message
  985.         mov     numerr,0                ; complaint message
  986.         call    num0                    ; parse numerical input
  987.         jc      setdly1                 ; c = error
  988.         mov     trans.sdelay,al
  989. setdly1:jmp     rskp                    ; success or failure
  990. SETDELY ENDP
  991.  
  992. ; SET DISPLAY Quiet/Regular/Serial/7-Bit/8-Bit (inverse of Set Remote on/off)
  993. ; Accepts two keywords in one command
  994. disply  proc    near
  995.         mov     ah,cmkey
  996.         mov     dx,offset distab
  997.         mov     bx,offset dishlp
  998.         call    comnd
  999.          ret
  1000.          nop
  1001.          nop
  1002.         mov     temp1,bx                ; save parsed value
  1003.         mov     temp2,0ffffh            ; assume no second keyword
  1004.         mov     comand.cmcr,1           ; bare CR's are allowed
  1005.         mov     ah,cmkey                ; parse for second keyword
  1006.         mov     dx,offset distab
  1007.         mov     bx,offset dishlp
  1008.         call    comnd
  1009.          jmp    short displ1            ; no keyword
  1010.          nop
  1011.         mov     temp2,bx                ; get key value
  1012. displ1: mov     comand.cmcr,0           ; bare CR's are not allowed
  1013.         mov     ah,cmcfm
  1014.         call    comnd                   ; confirm
  1015.          ret                            ; return on failure
  1016.          nop
  1017.          nop
  1018.         mov     ax,temp1                ; examine first key value
  1019.         call    dispcom                 ; do common code
  1020.         mov     ax,temp2                ; examine second key value
  1021.         call    dispcom
  1022.         jmp     rskp
  1023.  
  1024. dispcom:cmp     ax,0                    ; check range
  1025.         jle     displ3                  ; le = not legal, ignore
  1026.         cmp     al,7                    ; 7-8 bit value?
  1027.         jge     displ2                  ; ge = yes
  1028.         and     flags.remflg,not(dquiet+dregular+dserial)
  1029.         or      flags.remflg,al         ; set display mode
  1030.         ret                             ; check next key value
  1031. displ2: cmp     al,8                    ; set 8-bit wide display?
  1032.         ja      displ3                  ; a = bad value
  1033.         and     flags.remflg,not d8bit  ; assume want 7 bit mode
  1034.         cmp     al,7                    ; really want 7 bit mode?
  1035.         je      displ3                  ; e = yes
  1036.         or      flags.remflg,d8bit      ; set 8 bit flag
  1037. displ3: ret                             ; end of display common code
  1038. disply  endp
  1039.  
  1040.  
  1041. ; Set Dump filename  for saving screen images on disk. [jrd]
  1042. ; Puts filename in global string dmpname
  1043. setdmp  proc    near
  1044.         mov     dx,offset rdbuf         ; work area
  1045.         mov     rdbuf,0                 ; clear it
  1046.         mov     bx,offset dmphlp        ; help message
  1047.         mov     ah,cmfile               ; allow paths
  1048.         call    comnd
  1049.          ret
  1050.          nop
  1051.          nop
  1052.         mov     ah,cmcfm
  1053.         call    comnd
  1054.          ret
  1055.          nop
  1056.          nop
  1057.         mov     dx,offset rdbuf         ; assume we will use this text
  1058.         call    strlen                  ; filename given?
  1059.         mov     si,dx                   ; for strcpy
  1060.         cmp     cx,0                    ; length of user's filename
  1061.         jg      setdmp1                 ; g = filename is given
  1062.         mov     si,offset dmpdefnam     ; no name, use default instead
  1063. setdmp1:mov     di,offset dmpname       ; copy to globally available loc
  1064.         call    strcpy
  1065.         jmp     rskp
  1066. setdmp  endp
  1067.  
  1068. ; SET EOF
  1069.  
  1070. SETEOF  PROC    NEAR
  1071.         mov     bx,0
  1072.         mov     dx,offset seoftab
  1073.         call    keyend
  1074.          ret
  1075.          nop
  1076.          nop
  1077.         mov     flags.eofcz,bl          ; set value
  1078.         jmp     rskp
  1079. SETEOF  ENDP
  1080.  
  1081. ; SET EOL char (for Sent packets)
  1082. ; Archic, here for downward compatibility
  1083. EOLSET  PROC    NEAR
  1084.         mov     stflg,'S'               ; set send/receive flag to Send
  1085.         jmp     sreol                   ; use Set Send/Rec routine do the work
  1086. EOLSET  ENDP
  1087.  
  1088. ; SET ERRORLEVEL number
  1089. SETERL  PROC    NEAR
  1090.         mov     numhlp,offset erlhlp    ; help
  1091.         mov     numerr,0                ; error message
  1092.         mov     min,0                   ; smallest number
  1093.         mov     max,255                 ; largest magnitude
  1094.         call    num0                    ; parse numerical input
  1095.         jc      seterl1                 ; c = error
  1096.         mov     errlev,al               ; store result
  1097. seterl1:jmp     rskp                    ; success or failure
  1098. SETERL  ENDP
  1099.  
  1100. ; SET ESCAPE character.
  1101. ; Accept literal control codes and \### numbers. [jrd] 18 Oct 1987
  1102. ESCSET  PROC    NEAR
  1103.         mov     ah,cmfile
  1104.         mov     dx,offset rdbuf         ; work space
  1105.         mov     word ptr rdbuf,0        ; clear it
  1106.         mov     bx,offset eschlp        ; help
  1107.         call    comnd
  1108.          ret
  1109.          nop
  1110.          nop
  1111.         cmp     ah,0                    ; anything given?
  1112.         jne     escse1                  ; ne = yes
  1113.         mov     dx,offset ermes6        ; more parameters needed
  1114.         jmp     reterr
  1115. escse1: mov     ah,cmcfm                ; get a confirm
  1116.         call    comnd
  1117.          ret
  1118.          nop
  1119.          nop
  1120.         mov     si,offset rdbuf         ; source of chars
  1121.         call    katoi                   ; convert escaped numbers to binary
  1122.         cmp     ax,spc                  ; is it a control code?
  1123.         jae     escse2                  ; ae = no, complain
  1124.         cmp     ax,0                    ; non-zero too?
  1125.         je      escse2                  ; e = zero
  1126.         mov     trans.escchr,al         ; Save new value.
  1127.         jmp     rskp
  1128. escse2: mov     dx,offset escerr
  1129.         jmp     reterr
  1130. ESCSET  ENDP
  1131.  
  1132. SETATT  PROC    NEAR                    ; Set attributes on | off
  1133.         mov     dx,offset ontab
  1134.         mov     bx,0
  1135.         call    keyend
  1136.          ret
  1137.          nop
  1138.          nop
  1139.         mov     flags.attflg,bl
  1140.         jmp     rskp
  1141. SETATT  ENDP
  1142.  
  1143. ; SET FILEWARNING
  1144.  
  1145. FILWAR  PROC    NEAR
  1146.         mov     dx,offset ontab
  1147.         mov     bx,0
  1148.         call    keyend
  1149.          ret
  1150.          nop
  1151.          nop
  1152.         mov     flags.flwflg,bl         ; Set the filewarning flag
  1153.         jmp     rskp
  1154. FILWAR  ENDP
  1155.  
  1156. ; SET FLOW-CONTROL
  1157.  
  1158. FLOSET  PROC    NEAR
  1159.         mov     dx,offset flotab
  1160.         xor     bx,bx
  1161.         call    keyend
  1162.          ret
  1163.          nop
  1164.          nop
  1165.         mov     si,portval
  1166.         mov     [si].flowc,bx           ; Flow control value
  1167.         mov     [si].floflg,bl          ; Say if doing flow control
  1168.         jmp     rskp
  1169. FLOSET  ENDP
  1170.  
  1171. ; SET HANDSHAKE
  1172. ; Add ability to accept general decimal code. [jrd]
  1173.  
  1174. HNDSET  PROC    NEAR
  1175.         mov     dx,offset hndtab        ; table to scan
  1176.         mov     bx,offset hnd1hlp       ; help message
  1177.         mov     ah,cmkey
  1178.         call    comnd
  1179.          ret
  1180.          nop
  1181.          nop
  1182.         cmp     bl,0ffh                 ; want a general char code?
  1183.         jne     hnd1                    ; ne = no
  1184.         mov     min,0                   ; get decimal char code
  1185.         mov     max,31                  ; range is 0 to 31 decimal
  1186.         mov     numhlp,offset ctlhlp    ; help message
  1187.         mov     numerr,0                ; error message
  1188.         call    num0                    ; convert number, return it in ax
  1189.         jc      hnd2                    ; c = error
  1190.         mov     bx,ax                   ; recover numerical code
  1191. hnd1:
  1192.         mov     temp,bx                 ; handshake type
  1193.         mov     ah,cmcfm
  1194.         call    comnd                   ; Get a confirm
  1195.          ret                            ; Didn't get a confirm
  1196.          nop
  1197.          nop
  1198.         mov     bx,temp                 ; recover bx
  1199.         mov     si,portval
  1200.         cmp     bl,0                    ; Setting handshake off?
  1201.         je      hnd0                    ; Yes
  1202.         mov     [si].hndflg,1           ; And turn on handshaking
  1203.         mov     [si].hands,bl           ; Use this char as the handshake
  1204.         jmp     rskp
  1205. hnd0:   mov     [si].hndflg,0           ; No handshaking
  1206. hnd2:   jmp     rskp
  1207. HNDSET  ENDP
  1208.  
  1209. ;   SET INCOMPLETE file disposition
  1210.  
  1211. ABFSET  PROC    NEAR
  1212.         mov     dx,offset abftab
  1213.         mov     bx,0
  1214.         call    keyend
  1215.          ret
  1216.          nop
  1217.          nop
  1218.         mov     flags.abfflg,bl         ; Set the aborted file flag
  1219.         jmp     rskp
  1220. ABFSET  ENDP
  1221. ;
  1222. ; Set Input commands (default-timeout, timeout-action, case, echo)
  1223. ; By Jim Strudevant [jrs]
  1224. INPSET  PROC    NEAR
  1225.         mov     ah,cmkey                ; key word
  1226.         mov     dx,offset inptab        ; from inputtable
  1227.         mov     bx,0                    ; no hints
  1228.         call    comnd                   ; get the word
  1229.          ret                            ; they blew it
  1230.          nop
  1231.          nop
  1232.         jmp     bx                      ; do the sub command
  1233. ;
  1234. ; Set Input Default-timeout in seconds
  1235. ;
  1236. inptmo: mov     numhlp,offset intoms    ; help
  1237.         mov     numerr,0                ; error message
  1238.         mov     min,0                   ; smallest number
  1239.         mov     max,-1                  ; largest magnitude
  1240.         call    num0                    ; parse numerical input
  1241.         jc      inptmo1                 ; c = error
  1242.         mov     script.indfto,ax        ; store result
  1243. inptmo1:jmp     rskp                    ; success or failure
  1244. ;
  1245. ; Set Input Timeout action (proceed or quit)
  1246. ;
  1247. inpact: mov     dx,offset inactb        ; from this list
  1248.         mov     bx,0                    ; no hints
  1249.         call    keyend                  ; get it
  1250.          ret                            ; bad input
  1251.          nop
  1252.          nop
  1253.         mov     script.inactv,bl        ; save the action
  1254.         jmp     rskp                    ; good return
  1255. ;
  1256. ; Set Input Echo on or off
  1257. ;
  1258. inpeco: mov     dx,offset ontab         ; from this list
  1259.         mov     bx,0                    ; no hints
  1260.         call    keyend                  ; get it
  1261.          ret                            ; bad input
  1262.          nop
  1263.          nop
  1264.         mov     script.inecho,bl        ; save the action
  1265.         jmp     rskp                    ; good return
  1266. ;
  1267. ; Set Input Case observe or ignore
  1268. ;
  1269. inpcas: mov     dx,offset incstb        ; from this list
  1270.         mov     bx,0                    ; no hints
  1271.         call    keyend                  ; get it
  1272.          ret                            ; bad input
  1273.          nop
  1274.          nop
  1275.         mov     script.incasv,bl        ; save the action
  1276.         jmp     rskp                    ; good return
  1277. INPSET  ENDP
  1278.  
  1279. ; SET KEY
  1280. ; Jumps to new Set Key routine
  1281. setkey  proc    near
  1282.         cmp     stkadr,0        ; keyboard translator present?
  1283.         je      setk4           ; e = no, use this routine
  1284.         mov     bx,stkadr       ; yes, get offset of procedure
  1285.         jmp     bx              ; jump to keyboard translator
  1286. setk4:  mov     dx,offset ermes5
  1287.         jmp     reterr          ; else print error message
  1288. setkey  endp
  1289.  
  1290. ; SET LOCAL-ECHO {ON | OFF}
  1291.  
  1292. LCAL    PROC    NEAR
  1293.         mov     dx,offset ontab
  1294.         mov     bx,0
  1295.         call    keyend
  1296.          ret
  1297.          nop
  1298.          nop
  1299.         mov     si,portval
  1300.         mov     [si].ecoflg,bl          ; Set the local echo flag
  1301.         jmp     rskp
  1302. LCAL    ENDP
  1303.  
  1304. ; LOG  {PACKETS | SESSION | TRANSACTION} filename
  1305.  
  1306. setcpt  proc    near
  1307.         mov     dx,offset logtab        ; kinds of logging
  1308.         mov     bx,offset loghlp        ; help on kind of logging
  1309.         mov     ah,cmkey                ; parse keyword
  1310.         call    comnd
  1311.          ret
  1312.          nop
  1313.          nop
  1314.         mov     temp,bx                 ; Save the parsed value
  1315.         mov     dx,offset rdbuf         ; holds the complete filename
  1316.         mov     rdbuf,0                 ; clear buffer
  1317.         mov     bx,offset filhlp        ; ask for filename
  1318.         mov     ah,cmfile               ; allow paths
  1319.         call    comnd
  1320.          ret
  1321.          nop
  1322.          nop
  1323.         mov     ah,cmcfm
  1324.         call    comnd                   ; Get a confirm
  1325.          ret                            ;  Didn't get a confirm
  1326.          nop
  1327.          nop
  1328.         mov     bx,temp                 ; recover kind of logging
  1329.         mov     dx,offset rdbuf         ; length of filename to cx
  1330.         call    strlen                  ; length of given filename
  1331.  
  1332.         test    bl,logpkt               ; packet logging?
  1333.         jz      setcp2                  ; z = no, try others
  1334.         mov     dx,offset lpktnam       ; filename
  1335.         jcxz    setcp1                  ; z = no filename given
  1336.         mov     si,offset rdbuf         ; get new name
  1337.         mov     di,dx                   ; destination
  1338.         call    strcpy                  ; replace old name
  1339. setcp1: cmp     ploghnd,-1              ; packet log file already open?
  1340.         je      setcp6                  ; e = no, open it
  1341.         jmp     setcp16                 ; say file is open already
  1342.  
  1343. setcp2: test    bl,logses               ; session logging?
  1344.         jz      setcp4                  ; z = no, try others
  1345.         mov     dx,offset lsesnam       ; use default name
  1346.         jcxz    setcp3                  ; z = no filename given
  1347.         mov     si,offset rdbuf         ; get new name
  1348.         mov     di,dx                   ; destination
  1349.         call    strcpy                  ; replace old name
  1350. setcp3: cmp     sloghnd,-1              ; transaction file already open?
  1351.         je      setcp6                  ; e = no, open it
  1352.         jmp     setcp16                 ; say file is open already
  1353.  
  1354. setcp4: test    bl,logtrn               ; transaction logging?
  1355.         jz      setcp14                 ; z = no, error
  1356.         mov     dx,offset ltranam       ; use default name
  1357.         jcxz    setcp5                  ; z = no filename given
  1358.         mov     si,offset rdbuf         ; get new name
  1359.         mov     di,dx                   ; destination
  1360.         call    strcpy                  ; replace old name
  1361. setcp5: cmp     tloghnd,-1              ; transaction file already open?
  1362.         je      setcp6                  ; e = no, open it
  1363.         jmp     setcp16                 ; say file is open already
  1364.  
  1365. setcp6: mov     ax,dx                   ; place for filename for isfile
  1366.         call    isfile                  ; does file exist already?
  1367.         jc      setcp7                  ; c = does not exist so use create
  1368.         test    byte ptr filtst.dta+21,1fh ; file attributes, ok to write?
  1369.         jnz     setcp14                 ; nz = no, use error exit
  1370.         mov     ah,open2                ; open existing file
  1371.         mov     al,1+1                  ;  for writing and reading
  1372.         int     dos
  1373.         jc      setcp14                 ; if carry then error
  1374.         mov     bx,ax                   ; file handle for seeking
  1375.         mov     cx,0                    ; high order displacement
  1376.         mov     dx,0                    ; low order part of displacement
  1377.         mov     ah,lseek                ; seek to EOF (to do appending)
  1378.         mov     al,2                    ; says to EOF
  1379.         int     dos
  1380.         jmp     short setcp8
  1381.  
  1382. setcp7: test    filtst.fstat,80h        ; access problem?
  1383.         jnz     setcp14                 ; nz = yes, stop here
  1384.         mov     ah,creat2               ; function is create
  1385.         mov     cl,20H                  ; turn on archive bit
  1386.         mov     ch,0
  1387.         int     dos                     ; create the file, DOS 2.0
  1388.         jc      setcp14                 ; if carry bit set then error
  1389.         mov     bx,ax                   ; file handle
  1390.  
  1391. setcp8: cmp     temp,logpkt             ; packet logging?
  1392.         jne     setcp9                  ; ne = no
  1393.         mov     ploghnd,bx              ; save transaction log handle here
  1394.         jmp     short setcp12
  1395. setcp9: cmp     temp,logses             ; session logging?
  1396.         jne     setcp10                 ; ne = no
  1397.         mov     sloghnd,bx              ; save session log handle here
  1398.         jmp     short setcp12
  1399. setcp10:mov     tloghnd,bx              ; save transaction log handle here
  1400.  
  1401. setcp12:mov     ax,temp                 ; kind of Logging
  1402.         or      flags.capflg,al         ; accumulate kinds of logging
  1403.         jmp     rskp                    ; and return
  1404.  
  1405. setcp14:mov     dx,offset errcap        ; give error message
  1406.         jmp     reterr                  ; and display it
  1407.  
  1408. setcp16:mov     ah,prstr                ; file already open
  1409.         mov     dx,offset erropn
  1410.         int     dos
  1411.         jmp     rskp                    ; return success
  1412. setcpt  endp
  1413.  
  1414. ; SET MODE LINE
  1415.  
  1416. MODL    PROC    NEAR
  1417.         mov     dx,offset ontab         ; parse an on or off
  1418.         mov     bx,0                    ; no special help
  1419.         call    keyend
  1420.          ret
  1421.          nop
  1422.          nop
  1423.         mov     flags.modflg,bl         ; set flag appropriately
  1424.         jmp     rskp
  1425. MODL    ENDP
  1426.  
  1427. ; SET PARITY
  1428.  
  1429. SETPAR  PROC    NEAR
  1430.         mov     dx,offset partab
  1431.         mov     bx,0
  1432.         call    keyend
  1433.          ret
  1434.          nop
  1435.          nop
  1436.         mov     si,portval
  1437.         mov     [si].parflg,bl          ; Set the parity flag
  1438.         cmp     bl,parnon               ; Resetting parity to none?
  1439.         je      setp0                   ; e = yes, reset 8 bit quote character
  1440.         mov     trans.ebquot,dqbin      ; we want quoting, active
  1441.         mov     dtrans.ebquot,dqbin     ; we want quoting, our default
  1442.         jmp     short setp1
  1443. setp0:  mov     trans.ebquot,'Y'        ; say will quote upon request
  1444.         mov     dtrans.ebquot,'Y'       ; and our default
  1445.         setp1:  jmp     rskp
  1446. SETPAR  ENDP
  1447.  
  1448. ; SET PROMPT  Allow user to change the "Kermit-MS>" prompt
  1449. ; {string} and \number notation permitted to represent special chars. [jrd]
  1450.  
  1451. PROMSET PROC    NEAR
  1452.         mov     ah,cmtxt
  1453.         mov     bx,offset rdbuf         ; Read in the prompt
  1454.         mov     word ptr [bx],0         ; clear buffer
  1455.         mov     dx,offset prmmsg
  1456.         call    comnd
  1457.          ret
  1458.          nop
  1459.          nop
  1460.         cmp     rdbuf,0                 ; Just a bare CR?
  1461.         jne     prom0                   ; ne = no
  1462.         mov     ax,offset kerm          ; yes, restore default prompt
  1463.         jmp     prom1
  1464. prom0:  push    si                      ; parse \### constants into
  1465.         push    di                      ;  1 byte binary numbers inline
  1466.         mov     si,offset rdbuf         ; source = new prompt string
  1467.         mov     byte ptr [si-1+length rdbuf],0 ; plant null terminator
  1468.         mov     di,offset prm           ; destination
  1469.         call    cnvlin                  ; convert \### in string to binary
  1470.         pop     di
  1471.         pop     si
  1472.         mov     bx,cx                   ; get byte count
  1473.         add     bx,offset prm           ; point to null terminator
  1474.         mov     byte ptr [bx],'$'       ; End of string
  1475.         mov     ax,offset prm
  1476. prom1:  mov     prmptr,ax               ; Remember it
  1477.         jmp     rskp
  1478. PROMSET ENDP
  1479.  
  1480. ; SET SERVER TIMEOUT
  1481.  
  1482. SETSRV  PROC    NEAR
  1483.         mov     dx,offset srvtab        ; set server table
  1484.         mov     bx,0                    ; use table for help
  1485.         mov     ah,cmkey                ; get keyword
  1486.         call    comnd
  1487.          ret
  1488.          nop
  1489.          nop
  1490.         mov     min,0                   ; smallest acceptable value
  1491.         mov     max,255                 ; largest acceptable value, one byte
  1492.         mov     numhlp,offset srvthlp   ; help message
  1493.         mov     numerr,0                ; complaint message
  1494.         call    num0                    ; parse numerical input
  1495.         jc      setsrv1                 ; c = error
  1496.         mov     srvtmo,al               ; store timeout value
  1497. setsrv1:jmp     rskp
  1498. SETSRV  ENDP
  1499.  
  1500. ; SET RETRY value. Changes the packet retry limit. [jrd]
  1501.  
  1502. RETRYSET PROC   NEAR
  1503.         mov     min,1                   ; smallest acceptable value
  1504.         mov     max,63                  ; largest acceptable value
  1505.         mov     numhlp,offset retryhlp  ; help message
  1506.         mov     numerr,0                ; complaint message
  1507.         call    num0                    ; parse numerical input
  1508.         jc      retrys1                 ; c = error
  1509.         mov     maxtry,al
  1510.         shl     al,1                    ; quick multiply by two or three
  1511.         mov     imxtry,al               ; keep that much
  1512.         add     al,maxtry               ; try three times
  1513.         js      retrys1                 ; s = sign bit set, too much
  1514.         mov     imxtry,al               ; I packets get 3 times as many tries
  1515. retrys1:jmp     rskp
  1516. RETRYSET ENDP
  1517.  
  1518. ; SET TAKE-ECHO  on or off
  1519.  
  1520. TAKSET  PROC    NEAR
  1521.         mov     dx,offset ontab
  1522.         mov     bx,0
  1523.         call    keyend
  1524.          ret
  1525.          nop
  1526.          nop
  1527.         mov     flags.takflg,bl
  1528.         jmp     rskp
  1529. TAKSET  ENDP
  1530.  
  1531. ; SET TIMER     on or off during file transfer
  1532.  
  1533. TIMSET  PROC    NEAR
  1534.         mov     dx,offset ontab
  1535.         mov     bx,0
  1536.         call    keyend
  1537.          ret
  1538.          nop
  1539.          nop
  1540.         mov     flags.timflg,bl
  1541.         jmp     rskp
  1542. TIMSET  ENDP
  1543.  
  1544. ; SET SEND parameters
  1545.  
  1546. SENDSET PROC    NEAR
  1547.         mov     stflg,'S'               ; Setting SEND parameter
  1548. sndst0: mov     dx,offset stsrtb        ; Parse a keyword
  1549.         mov     bx,0                    ; no specific help
  1550.         mov     ah,cmkey
  1551.         call    comnd
  1552.          ret                            ; bad user text
  1553.          nop
  1554.          nop
  1555.         jmp     bx                      ; do the action routine
  1556. SENDSET ENDP
  1557.  
  1558. ; SET RECEIVE parameters
  1559.  
  1560. recset: mov     stflg,'R'               ; Setting RECEIVE paramter
  1561.         jmp     sndst0
  1562.  
  1563. remset  proc    near                    ; Set REMOTE ON/OFF
  1564.         mov     dx,offset ontab
  1565.         mov     bx,offset remhlp
  1566.         call    keyend
  1567.          ret
  1568.          nop
  1569.          nop
  1570.         and     flags.remflg,not (dquiet+dserial+dregular) ; no display bits
  1571.         or      bl,bl                   ; want off state? (same as regular)
  1572.         jz      remset1                 ; z = yes
  1573.         or      flags.remflg,dquiet     ; else on = quiet display
  1574.         jmp     short remset2
  1575. remset1:or      flags.remflg,dregular   ; off = regular display
  1576. remset2:jmp     rskp
  1577. remset  endp
  1578.  
  1579.  
  1580. ; SET Send and Receive EOL char
  1581.  
  1582. sreol   PROC    NEAR
  1583.         mov     min,0                   ; lowest acceptable value
  1584.         mov     max,1FH                 ; largest acceptable value
  1585.         mov     numhlp,offset ctlhlp    ; Reuse help message
  1586.         mov     numerr,0                ; error message address
  1587.         call    num0                    ; get numerical input
  1588.         jc      sreol3                  ; c = error
  1589.         cmp     stflg,'S'               ; Setting SEND paramter?
  1590.         je      sreol1
  1591.         mov     trans.reol,al
  1592.         jmp     short sreol2
  1593. sreol1: mov     dtrans.seol,al
  1594. sreol2: mov     ah,dtrans.seol
  1595.         mov     trans.seol,ah
  1596. sreol3: jmp     rskp
  1597. sreol   ENDP
  1598.  
  1599.  
  1600. ; SET SEND and RECEIVE start-of-header
  1601.  
  1602. srsoh:  mov     min,0
  1603.         mov     max,1FH
  1604.         mov     numhlp,offset ctlhlp    ; Reuse help message
  1605.         mov     numerr,0                ; error message
  1606.         call    num0            ; Common routine for parsing numerical input
  1607.         jc      srsoh2                  ; c = error
  1608.         cmp     stflg,'S'               ; Setting SEND paramter?
  1609.         je      srsoh1
  1610.         mov     trans.rsoh,al           ; set Receive soh
  1611.         jmp     short srsoh2
  1612. srsoh1: mov     trans.ssoh,al           ; set Send soh
  1613. srsoh2: jmp     rskp                    ; success or failure
  1614.  
  1615. ; SET SEND and  RECEIVE TIMEOUT
  1616.  
  1617. srtim:  mov     min,0
  1618.         mov     max,94
  1619.         mov     numhlp,offset timhlp    ; Reuse help message
  1620.         mov     numerr,0                ; error message
  1621.         call    num0            ; Common routine for parsing numerical input
  1622.         jc      srtim3                  ; c = error
  1623.         cmp     stflg,'S'               ; Setting SEND paramter?
  1624.         je      srtim1
  1625.         mov     trans.rtime,al
  1626.         jmp     short srtim2
  1627. srtim1: mov     dtrans.stime,al
  1628. srtim2: mov     ah,dtrans.stime
  1629.         mov     trans.stime,ah
  1630. srtim3: jmp     rskp
  1631.  
  1632. ; SET SEND and RECEIVE PACKET LENGTH
  1633.  
  1634. srpack: mov     min,20
  1635.         mov     max,maxpack
  1636.         mov     numhlp,offset pakhlp    ; help
  1637.         mov     numerr,offset pakerr    ; error message
  1638.         call    num0
  1639.         jc      srpak2                  ; c = error
  1640.         cmp     stflg,'S'               ; setting send value?
  1641.         jne     srpakr                  ; ne = receive
  1642.         mov     trans.slongp,ax         ; set send value
  1643.         mov     trans.slong,ax          ; and remember what we Set
  1644.         cmp     ax,94                   ; within normal packet range?
  1645.         ja      srpak2                  ; a = no
  1646.         mov     trans.spsiz,al          ; yes. update regular pkt size too
  1647. srpak2: jmp     rskp                    ; success or failure
  1648. srpakr: mov     trans.rlongp,ax         ; set receive value
  1649.         cmp     ax,94                   ; within normal packet range?
  1650.         ja      srpak4                  ; a = no
  1651.         mov     trans.rpsiz,al          ; yes. update regular pkt size too
  1652. srpak4: jmp     rskp
  1653.  
  1654.  
  1655. ; SET SEND and RECEIVE number of padding characters
  1656.  
  1657. srnpd:  mov     min,0
  1658.         mov     max,99
  1659.         mov     numhlp,offset padhlp    ; help message
  1660.         mov     numerr,0                ; error message
  1661.         call    num0                    ; Parse numerical input
  1662.         jc      srnpd3                  ; c = error
  1663.         cmp     stflg,'S'               ; Setting SEND paramter?
  1664.         je      srnpd1                  ; e = yes
  1665.         mov     trans.rpad,al           ; set Receive padding
  1666.         jmp     short srnpd2
  1667. srnpd1: mov     dtrans.spad,al          ; set default Send padding
  1668. srnpd2: mov     al,dtrans.spad
  1669.         mov     trans.spad,al           ; update active array for I and S pkts
  1670. srnpd3: jmp     rskp                    ; success or failure
  1671.  
  1672. ; SET SEND and RECEIVE padding character
  1673.  
  1674. srpad:  mov     min,0
  1675.         mov     max,127
  1676.         mov     numhlp,offset padhlp
  1677.         mov     numerr,offset padhlp
  1678.         call    num0                    ; Parse numerical input
  1679.         jc      srpad4                  ; c = error
  1680.         cmp     ah,127                  ; This is allowed
  1681.         je      srpad1
  1682.         cmp     ah,32
  1683.         jb      srpad1                  ; Between 0 and 31 is OK too
  1684.         mov     ah,prstr
  1685.         mov     dx,offset padhlp
  1686.         int     dos
  1687. srpad1: cmp     stflg,'S'               ; Send?
  1688.         je      srpad2                  ; e = yes, else Receive
  1689.         mov     trans.rpadch,al         ; store receive pad char
  1690.         jmp     short srpad3
  1691. srpad2: mov     dtrans.spadch,al        ; store Send pad char
  1692. srpad3: mov     ah,dtrans.spadch
  1693.         mov     trans.spadch,ah         ; update active array for I and S pkts
  1694. srpad4: jmp     rskp
  1695.  
  1696. ; SET SEND and  RECEIVE control character prefix
  1697.  
  1698. srquo:  mov     min,33
  1699.         mov     max,126
  1700.         mov     numhlp,offset quohlp    ; help message
  1701.         mov     numerr,0                ; error message
  1702.         call    num0                    ; Parse numerical input
  1703.         jc      srquo3                  ; c = error
  1704.         cmp     stflg,'S'               ; Setting outgoing quote char?
  1705.         je      srquo1
  1706.         mov     trans.rquote,al         ; set Receive quote char
  1707.         jmp     short srquo2
  1708. srquo1: mov     dtrans.squote,al        ; set Send quote char
  1709. srquo2: mov     ah,dtrans.spadch
  1710.         mov     trans.spadch,ah         ; update active array for I and S pkts
  1711. srquo3: jmp     rskp
  1712.  
  1713. ; SET SEND Pause number of milliseconds
  1714.  
  1715. srpaus: mov     min,0
  1716.         mov     max,127
  1717.         mov     numhlp,offset pauhlp    ; help
  1718.         mov     numerr,0
  1719.         call    num0                    ; Parse numerical input
  1720.         pushf                           ; save carry for error state
  1721.         cmp     stflg,'S'               ; Setting SEND paramter?
  1722.         je      srpau0
  1723.         popf
  1724.         mov     dx,offset ermes5        ; "Not implemented" msg
  1725.         jmp     reterr                  ; print error message
  1726. srpau0: popf
  1727.         jc      srpau1                  ; c = error
  1728.         mov     spause,al               ; store value
  1729. srpau1: jmp     rskp
  1730.  
  1731. ; SET TRANSLATION INPUT   Connect mode translate incoming characters
  1732. ; SET TRANS IN {Original-byte New-byte | ON | OFF}
  1733.  
  1734. SETRX   PROC    NEAR                    ; translate incoming serial port char
  1735.         mov     ah,cmkey
  1736.         mov     dx,offset trnstab       ; direction table (just one entry)
  1737.         mov     bx,0                    ; no help
  1738.         call    comnd
  1739.          ret
  1740.          nop
  1741.          nop
  1742.         mov     dx,offset rdbuf         ; our work space
  1743.         mov     word ptr rdbuf,0        ; insert terminator
  1744.         mov     bx,offset srxhlp1       ; first help message
  1745.         mov     ah,cmfile               ; parse a word
  1746.         call    comnd                   ; get incoming byte pattern
  1747.          ret                            ; error if none
  1748.          nop
  1749.          nop
  1750.         or      ah,ah                   ; any text given?
  1751.         jz      setr6                   ; nz = no
  1752.         mov     temp,ax                 ; save byte count here
  1753.         mov     ax,word ptr rdbuf       ; get first two characters
  1754.         or      ax,2020h                ; convert upper to lower case
  1755.         cmp     ax,'fo'                 ; first part of word OFF?
  1756.         je      setr6                   ; e = yes, go analyze
  1757.         cmp     ax,'no'                 ; word ON?
  1758.         je      setr6                   ; e = yes, go do it
  1759.         mov     si,offset rdbuf         ; convert text to number
  1760.         call    katoi                   ; number converter procedure, to ax
  1761.         jnc     setr1                   ; nc = success
  1762.         cmp     byte ptr temp+1,1       ; just one character given?
  1763.         jne     setr6                   ; ne = no, so bad code
  1764. setr1:  mov     min,ax                  ; save byte code here
  1765.         mov     dx,offset rdbuf         ; our work space
  1766.         mov     word ptr rdbuf,0        ; insert terminator
  1767.         mov     bx,offset srxhlp1       ; first help message
  1768.         mov     ah,cmfile               ; parse a word
  1769.         call    comnd                   ; get incoming byte pattern
  1770.          ret
  1771.          nop
  1772.          nop
  1773.         or      ah,ah                   ; any text given?
  1774.         jz      setr6                   ; z = no
  1775.         mov     temp,ax                 ; save byte count here
  1776.         mov     si,offset rdbuf         ; convert text to number
  1777.         call    katoi                   ; number converter procedure
  1778.         jnc     setr3                   ; nc = success
  1779.         cmp     byte ptr temp+1,1       ; just one character given?
  1780.         jne     setr6                   ; ne = no, so bad code or ON/OFF
  1781. setr3:  mov     max,ax                  ; save byte code here
  1782.         mov     ah,cmcfm                ; get a confirm
  1783.         call    comnd
  1784.          ret                            ; no confirm
  1785.          nop
  1786.          nop
  1787.         mov     bx,min                  ; bl = incoming byte code
  1788.         xor     bh,bh
  1789.         mov     ax,max                  ; al = local (translated) byte code
  1790.         mov     rxtable [bx],al         ; store in rx translate table
  1791.         jmp     rskp
  1792.  
  1793. setr6:  mov     ah,cmcfm                ; get a confirm
  1794.         call    comnd
  1795.          ret
  1796.          nop
  1797.          nop
  1798.         mov     dx,offset badrx         ; assume bad construction
  1799.         or      word ptr rdbuf,2020h    ; convert to lower case
  1800.         or      rdbuf+2,20h             ; first three chars
  1801.         cmp     word ptr rdbuf,'fo'     ; key word OFF?
  1802.         jne     setr8                   ; ne = no
  1803.         cmp     rdbuf+2,'f'             ; last letter of OFF?
  1804.         jne     setr8
  1805.         mov     rxtable+256,0           ; OFF is status byte = zero
  1806.         mov     dx,offset rxoffmsg      ; say translation is turned off
  1807.         jmp     setr9
  1808. setr8:  cmp     word ptr rdbuf,'no'     ; keyword ON?
  1809.         jne     setr9a                  ; ne = no, error
  1810.         mov     rxtable+256,1           ; ON is status byte non-zero
  1811.         mov     dx,offset rxonmsg       ; say translation is turned on
  1812. setr9:  cmp     intake,0                ; executing from a Take file?
  1813.         je      setr9a                  ; e = no
  1814.         cmp     flags.takflg,0          ; echo contents of Take file?
  1815.         je      setr10                  ; e = no
  1816. setr9a: mov     ah,prstr                ; bad number message
  1817.         int     dos
  1818. setr10: jmp     rskp
  1819. SETRX   ENDP
  1820.  
  1821. ; SHOW TRANSLATE-RECEIVE
  1822. ; Display characters being changed for Connect mode serial receive translator
  1823.  
  1824. SHORX   PROC    NEAR                    ; show translate table of incoming
  1825.                                         ; chars, only those changed
  1826.         mov     ah,cmcfm                ; get a confirm
  1827.         call    comnd
  1828.           ret                           ; no confirm
  1829.           nop
  1830.           nop
  1831.         mov     ah,prstr
  1832.         mov     dx,offset rxoffmsg      ; assume translation is off
  1833.         cmp     rxtable+256,0           ; is translation off?
  1834.         je      shorx0                  ; e = yes
  1835.         mov     dx,offset rxonmsg       ; say translation is on
  1836. shorx0: int     dos
  1837.         mov     dx,offset shormsg       ; give title line
  1838.         int     dos
  1839.         xor     cx,cx                   ; formatted line counter
  1840.         xor     bx,bx                   ; entry subscript
  1841. shorx1: cmp     rxtable[bx],bl          ; entry same as normal?
  1842.         je      shorx2                  ; e = yes, skip it
  1843.         call    shoprt                  ; print the entry
  1844. shorx2: inc     bx                      ; next entry
  1845.         cmp     bx,255                  ; done all entries yet?
  1846.         jbe     shorx1                  ; be = not yet
  1847.         mov     ah,prstr
  1848.         mov     dx,offset crlf          ; end with cr/lf
  1849.         int     dos
  1850.         jmp     rskp
  1851.  
  1852. shoprt: cmp     cx,4                    ; done five entries for this line?
  1853.         jb      shopr1                  ; b = no
  1854.         mov     ah,prstr
  1855.         mov     dx,offset crlf          ; break line now
  1856.         int     dos
  1857.         xor     cx,cx
  1858. shopr1: mov     ah,prstr
  1859.         mov     dx,offset shopm1        ; start of display
  1860.         int     dos
  1861.         xor     ah,ah
  1862.         mov     al,bl                   ; original byte code
  1863.         call    decout                  ; display its value
  1864.         mov     ah,prstr
  1865.         mov     dx,offset shopm2        ; intermediate part of display
  1866.         int     dos
  1867.         xor     ah,ah
  1868.         mov     al,rxtable[bx]          ; new byte code
  1869.         call    decout                  ; display its value
  1870.         mov     ah,prstr
  1871.         mov     dx,offset shopm3        ; last part of display
  1872.         int     dos
  1873.         inc     cx                      ; count item displayed
  1874.         ret
  1875. SHORX   ENDP
  1876.  
  1877. ; SHOW MACRO [macro name]
  1878.  
  1879. SHOMAC  PROC    NEAR
  1880.         mov     ah,cmfile
  1881.         mov     dx,offset rdbuf
  1882.         mov     bx,offset shmmsg
  1883.         mov     comand.cmper,1          ; don't react to \%x variables
  1884.         call    comnd
  1885.          ret
  1886.          nop
  1887.          nop
  1888.         mov     al,ah
  1889.         mov     ah,0
  1890.         mov     shmcnt,ax               ; save length of user spec
  1891.         mov     ah,cmcfm
  1892.         call    comnd
  1893.          ret
  1894.          nop
  1895.          nop
  1896.         mov     si,offset mcctab        ; table of macro names
  1897.         cld
  1898.         lodsb
  1899.         mov     cl,al                   ; number of macro entries
  1900.         mov     ch,0
  1901.         jcxz    shom6                   ; z = none
  1902.         mov     temp,0                  ; count of macros displayed
  1903. shom2:  push    cx                      ; save loop counter
  1904.         lodsb                           ; length of macro name
  1905.         mov     ah,0
  1906.         mov     cx,shmcnt               ; length of user's string
  1907.         jcxz    shom4                   ; show all names
  1908.         cmp     al,cl                   ; mac name shorter that user spec?
  1909.         jb      shom5                   ; b = yes, no match
  1910.         push    ax
  1911.         push    si                      ; save these around match test
  1912.         mov     di,offset rdbuf         ; user's string
  1913. shom3:  mov     ah,[di]
  1914.         inc     di
  1915.         lodsb                           ; al = mac name char, ah = user char
  1916.         and     ax,not 2020h            ; clear bits (uppercase chars)
  1917.         cmp     ah,al                   ; same?
  1918.         loope   shom3                   ; while equal, do more
  1919.         pop     si                      ; restore regs
  1920.         pop     ax
  1921.         jne     shom5                   ; ne = no match
  1922. shom4:  call    shom9                   ; show this name
  1923. shom5:  add     si,ax                   ; no match, skip name
  1924.         add     si,3                    ; and '$', and string pointer
  1925.         pop     cx                      ; recover loop counter
  1926.         loop    shom2                   ; one less macro to examine
  1927.  
  1928.         cmp     temp,0                  ; did we show any macros?
  1929.         jne     shom7                   ; ne = yes
  1930. shom6:  mov     ah,prstr
  1931.         mov     dx,offset shom9m3       ; no entries found
  1932.         int     dos
  1933. shom7:  mov     ah,prstr                ; Summary line
  1934.         mov     dx,offset shom9m1       ; free space: name entries
  1935.         int     dos
  1936.         mov     ax,offset mcctab+mcclen
  1937.         sub     ax,mccptr               ; compute # of free name bytes
  1938.         call    decout
  1939.         mov     ah,prstr
  1940.         mov     dx,offset shom9m2       ; body characters
  1941.         int     dos
  1942.         mov     ax,offset macbuf+maclen
  1943.         sub     ax,macptr
  1944.         call    decout
  1945.         mov     ah,prstr
  1946.         mov     dx,offset crlf
  1947.         int     dos
  1948.         jmp     rskp                    ; return successfully to caller
  1949.  
  1950.                                         ; worker, show mac name and def
  1951. shom9:  push    ax                      ; call with si pointing at macro
  1952.         push    si                      ; name, byte ptr [si-1] = length
  1953.         cmp     byte ptr[si],0          ; name starts with null char?
  1954.         je      shom9e                  ; yes, TAKE file, ignore
  1955.         mov     ah,prstr
  1956.         mov     dx,offset crlfsp        ; go to new line
  1957.         int     dos
  1958.         inc     temp                    ; count displayed macros
  1959.         mov     dx,si                   ; Print macro name
  1960.         int     dos
  1961.         mov     dx,offset eqs           ; display equals sign
  1962.         int     dos
  1963.         mov     al,[si-1]               ; length of macro name
  1964.         mov     ah,0
  1965.         add     si,ax                   ; skip over name
  1966.         add     si,1                    ; skip '$' field
  1967.         mov     si,[si]                 ; si = offset of count + string
  1968.         mov     cl,byte ptr [si]        ; length of string
  1969.         mov     ch,0
  1970.         inc     si                      ; si = offset of string text proper
  1971. shom9a: lodsb                           ; get a byte into al
  1972.         cmp     al,' '                  ; control char?
  1973.         jae     shom9c                  ; ae = no
  1974.         cmp     al,cr                   ; carriage return?
  1975.         jne     shom9b                  ; ne = no
  1976.         mov     ah,prstr
  1977.         mov     dx,offset shom9m4       ; show <cr>
  1978.         int     dos
  1979.         cmp     cx,1                    ; more to show?
  1980.         je      shom9d                  ; e = no
  1981.         mov     dx,offset crlfsp        ; show cr,lf,space,space
  1982.         int     dos
  1983.         cmp     byte ptr[si],lf         ; cr followed by linefeed?
  1984.         jne     short shom9d
  1985.         inc     si                      ; skip the leading lf
  1986.         dec     cx
  1987.         jmp     short shom9d
  1988. shom9b: push    ax
  1989.         mov     ah,conout
  1990.         mov     dl,5eh                  ; caret
  1991.         int     dos
  1992.         pop     ax
  1993.         add     al,'A'-1                ; add offset to make printable letter
  1994. shom9c: mov     ah,conout
  1995.         mov     dl,al                   ; display it
  1996.         int     dos
  1997. shom9d: loop    shom9a                  ; do whole string
  1998. shom9e: pop     si
  1999.         pop     ax
  2000.         ret
  2001. SHOMAC  ENDP
  2002.  
  2003. SHCOM   PROC    NEAR                    ; Show Modem
  2004.         mov     ah,cmcfm
  2005.         call    comnd                   ; Get a confirm
  2006.          ret                            ; Didn't get a confirm
  2007.          nop
  2008.          nop
  2009.         mov     dx,offset crlf
  2010.         mov     ah,prstr
  2011.         int     dos                     ; print a crlf
  2012.         mov     bx,offset stcom         ; table of items to be shown
  2013.         call    statc                   ; finish in common code
  2014.          nop
  2015.          nop
  2016.          nop
  2017.         call    shomodem
  2018.          nop
  2019.          nop
  2020.          nop
  2021.         jmp     rskp
  2022. SHCOM   ENDP
  2023. SHFILE  PROC    NEAR                    ; Show File
  2024.         mov     ah,cmcfm
  2025.         call    comnd                   ; Get a confirm
  2026.          ret                            ; Didn't get a confirm
  2027.          nop
  2028.          nop
  2029.         mov     dx,offset crlf
  2030.         mov     ah,prstr
  2031.         int     dos                     ; print a crlf
  2032.         mov     bx,offset stfile        ; table of items to be shown
  2033.         jmp     statc                   ; finish in common code
  2034. SHFILE  ENDP
  2035.  
  2036. SHLOG   PROC    NEAR                    ; Show Log
  2037.         mov     ah,cmcfm
  2038.         call    comnd                   ; Get a confirm
  2039.          ret
  2040.          nop
  2041.          nop
  2042.         mov     dx,offset crlf
  2043.         mov     ah,prstr
  2044.         int     dos                     ; print a crlf
  2045.         mov     bx,offset stlog         ; table of items to be shown
  2046.         jmp     statc                   ; finish in common code
  2047. SHLOG   ENDP
  2048. SHPRO   PROC    NEAR                    ; Show Protocol
  2049.         mov     ah,cmcfm
  2050.         call    comnd                   ; Get a confirm
  2051.          ret
  2052.          nop
  2053.          nop
  2054.         mov     dx,offset crlf
  2055.         mov     ah,prstr
  2056.         int     dos                     ; print a crlf
  2057.         mov     bx,offset stpro         ; table of items to be shown
  2058.         jmp     statc                   ; finish in common code
  2059. SHPRO   ENDP
  2060. SHSCPT  PROC    NEAR                    ; Show Script
  2061.         mov     ah,cmcfm
  2062.         call    comnd                   ; Get a confirm
  2063.          ret
  2064.          nop
  2065.          nop
  2066.         mov     dx,offset crlf
  2067.         mov     ah,prstr
  2068.         int     dos                     ; print a crlf
  2069.         mov     bx,offset stscpt        ; table of items to be shown
  2070.         jmp     statc                   ; finish in common code
  2071. SHSCPT  ENDP
  2072. SHSERV  PROC    NEAR                    ; Show Server
  2073.         mov     ah,cmcfm
  2074.         call    comnd                   ; Get a confirm
  2075.          ret
  2076.          nop
  2077.          nop
  2078.         mov     dx,offset crlf
  2079.         mov     ah,prstr
  2080.         int     dos                     ; print a crlf
  2081.         mov     bx,offset stserv2       ; do heartbeak item
  2082.         call    statc
  2083.          nop
  2084.          nop
  2085.          nop
  2086.         mov     dx,offset crlf
  2087.         mov     ah,prstr
  2088.         int     dos
  2089.         mov     bx,offset stserv        ; table of items to be shown
  2090.         jmp     statc                   ; finish in common code
  2091. SHSERV  ENDP
  2092.  
  2093. SHTERM  PROC    NEAR                    ; Show Terminal
  2094.         mov     ah,cmcfm
  2095.         call    comnd                   ; Get a confirm
  2096.          ret
  2097.          nop
  2098.          nop
  2099.         mov     dx,offset crlf
  2100.         mov     ah,prstr
  2101.         int     dos                     ; print a crlf
  2102.         mov     bx,offset stterm        ; table of items to be shown
  2103.         jmp     statc                   ; use common code
  2104. SHTERM  ENDP
  2105.  
  2106. ; STATUS command. Revised by [jrd]
  2107.  
  2108. STATUS  PROC    NEAR
  2109.         mov     ah,cmcfm
  2110.         call    comnd                   ; Get a confirm
  2111.          ret
  2112.          nop
  2113.          nop
  2114.         mov     dx,offset crlf
  2115.         mov     ah,prstr
  2116.         int     dos                     ; print a crlf
  2117. STAT0:  call    cmblnk                  ; clear the screen
  2118.         call    locate                  ; home the cursor
  2119.         mov     bx,offset sttab         ; table to control printing
  2120.  
  2121. STATC:  push    es                      ; STAT0 is an external ref (in mster)
  2122.         push    di
  2123.         mov     cx,ds
  2124.         mov     es,cx
  2125.         cld
  2126.         xor     cx,cx                   ; column counter
  2127. stat1:  cmp     word ptr [bx],0         ; end of table?
  2128.         je      statx                   ; e = yes
  2129.         cld                             ; string direction is forward
  2130.         mov     di,offset rdbuf         ; point to destination buffer
  2131.         mov     byte ptr[di],spc        ; start with two spaces
  2132.         inc     di
  2133.         mov     byte ptr[di],spc
  2134.         inc     di
  2135.         push    cx                      ; save column number
  2136.         push    bx
  2137.         call    [bx].sttyp              ; call appropriate routine
  2138.         pop     bx
  2139.         pop     cx
  2140.         sub     di,offset rdbuf         ; number of bytes used
  2141.         add     cx,di                   ; new line col count
  2142.         push    cx                      ; save col number around print
  2143.         mov     cx,di                   ; how much to print now
  2144.         mov     di,offset rdbuf         ; source text
  2145.         cmp     cx,2                    ; nothing besides our two spaces?
  2146.         jbe     stat5                   ; e = yes, forget it
  2147.         call    prtscr                  ; print counted string
  2148. stat5:  pop     cx
  2149.         add     bx,size stent           ; look at next entry
  2150.         cmp     word ptr [bx],0         ; at end of table?
  2151.         je      statx                   ; e = yes
  2152.         cmp     cx,38                   ; place for second display?
  2153.         jbe     stat2                   ; be = only half full
  2154.         mov     dx,offset crlf          ; over half full. send cr/lf
  2155.         mov     ah,prstr
  2156.         int     dos
  2157.         xor     cx,cx                   ; say line is empty now
  2158.         jmp     stat1
  2159. stat2:  mov     ax,cx
  2160.         mov     cx,38                   ; where we want to be next time
  2161.         sub     cx,ax                   ; compute number of filler spaces
  2162.         or      cx,cx
  2163.         jle     stat4                   ; nothing to do
  2164.         mov     ah,conout
  2165.         mov     dl,' '
  2166. stat3:  int     dos                     ; fill with spaces
  2167.         loop    stat3                   ; do cx times
  2168. stat4:  mov     cx,38                   ; current column number
  2169.         jmp     stat1                   ; and do it
  2170. statx:  pop     di
  2171.         pop     es
  2172.         jmp     rskp
  2173. STATUS  ENDP
  2174.  
  2175. ; handler routines for status
  2176. ; all are called with di/ destination buffer, bx/ stat ptr. They can change
  2177. ; any register except es:, must update di to the end of the buffer.
  2178.  
  2179. ; copy the message into the buffer
  2180. stmsg   proc    near
  2181.         push    ds
  2182.         pop     es              ; ensure es points to datas segment
  2183.         mov     si,[bx].msg     ; get message address
  2184. stms1:  lodsb                   ; get a byte
  2185.         stosb                   ; drop it off
  2186.         cmp     al,'$'          ; end of message?
  2187.         jne     stms1           ; no, keep going
  2188.         dec     di              ; else back up ptr
  2189.         ret
  2190. stmsg   endp
  2191.  
  2192. ; get address of test value in stent. Returns address in si
  2193. stval   proc    near
  2194.         mov     si,[bx].basval  ; get base value
  2195.         cmp     si,0            ; any there?
  2196.         je      stva1           ; no, keep going
  2197.         mov     si,[si]         ; yes, use as base address
  2198. stva1:  add     si,[bx].tstcel  ; add offset of test cell
  2199.         ret                     ; and return it
  2200. stval   endp
  2201.  
  2202. ; print a single character
  2203. onechr  proc    near
  2204.         call    stmsg           ; copy message part first
  2205.         call    stval           ; pick up test value address
  2206.         mov     al,[si]         ; this is char to print
  2207.         cmp     al,' '          ; printable?
  2208.         jae     onech1          ; yes, keep going
  2209.         add     al,64           ; make printable
  2210.         mov     byte ptr [di],5eh       ; caret
  2211.         inc     di              ; note ctrl char
  2212. onech1: stosb                   ; drop char off
  2213.         ret
  2214. onechr  endp
  2215.  
  2216. ; numeric field
  2217. stnum   proc    near            ; for 8 bit numbers
  2218.         call    stmsg           ; copy message
  2219.         call    stval           ; pick up value address
  2220.         mov     al,[si]         ; get value
  2221.         mov     ah,0            ; high order is 0
  2222.         call    outnum          ; put number into buffer
  2223.         ret
  2224. stnum   endp
  2225.  
  2226. stlnum  proc    near            ; for 16 bit numbers [jrd]
  2227.         call    stmsg           ; copy message
  2228.         call    stval           ; pick up value address
  2229.         mov     ax,[si]         ; get value
  2230.         call    outnum          ; put number into buffer
  2231.         ret
  2232. stlnum  endp
  2233.  
  2234. ; Common routine for parsing numerical input
  2235. ; Enter with numhlp = offset of help message, numerr = offset of optional
  2236. ;  error message, min, max = allowable range of values.
  2237. ; Returns value in ax, or does parse error return.
  2238. ; Changes ax,bx,dx,si.                  [jrd] 18 Oct 1987
  2239. num0:   mov     dx,offset rdbuf+1       ; were to put text
  2240.         mov     word ptr rdbuf,0        ; clear the buffer
  2241.         mov     bx,numhlp               ; help text
  2242.         mov     ah,cmfile               ; get a word
  2243.         call    comnd
  2244.          ret
  2245.          nop
  2246.          nop
  2247.         mov     ah,cmcfm
  2248.         call    comnd                   ; Get a confirm
  2249.          ret
  2250.          nop
  2251.          nop
  2252.         mov     si,offset rdbuf+1
  2253.         cmp     rdbuf+1,'\'             ; already quoted?
  2254.         je      num0a                   ; e = yes
  2255.         mov     rdbuf,'\'               ; add a numerical quote
  2256.         dec     si                      ; point to our escape char
  2257. num0a:  call    katoi                   ; convert number in rdbuf
  2258.         jc      num0er                  ; c = no number, error
  2259.         cmp     ax,max                  ; largest permitted value
  2260.         ja      num0er                  ; a = error
  2261.         cmp     ax,min                  ; smallest permitted value
  2262.         jb      num0er                  ; b = error
  2263.         clc
  2264.         ret                             ; return value in ax
  2265.  
  2266. num0er: mov     ah,prstr
  2267.         mov     dx,numerr               ; comand-specific error message, if any
  2268.         cmp     dx,0                    ; was any given?
  2269.         je      num0e1                  ; e = no, use generic msg
  2270.         int     dos                     ; show given error message
  2271.         jmp     short num0e2
  2272. num0e1: mov     dx,offset nummsg1       ; get address of numeric error message
  2273.         int     dos
  2274.         mov     ax,min                  ; smallest permitted number
  2275.         call    decout                  ; display decimal number in ax
  2276.         mov     ah,prstr
  2277.         mov     dx,offset nummsg2       ; "and"
  2278.         int     dos
  2279.         mov     ax,max                  ; largest permitted number
  2280.         call    decout
  2281. num0e2: stc
  2282.         ret
  2283. num0e3: mov     ah,prstr
  2284.         mov     dx,offset ermes7        ; say command not executed
  2285.         int     dos
  2286.         stc
  2287.         ret
  2288.  
  2289. ; translate the number in ax
  2290. outnum  proc    near
  2291.         mov     dx,0
  2292.         mov     bx,10
  2293.         div     bx              ; divide to get digit
  2294.         push    dx              ; save remainder digit
  2295.         or      ax,ax           ; test quotient
  2296.         jz      outnu1          ; zero, no more of number
  2297.         call    outnum          ; else call for rest of number
  2298. outnu1: pop     ax              ; get digit back
  2299.         add     al,'0'          ; make printable
  2300.         stosb                   ; drop it off
  2301.         ret
  2302. outnum  endp
  2303.  
  2304. ; on/off field
  2305. onoff   proc    near
  2306.         call    stmsg           ; copy message
  2307.         call    stval           ; get value cell
  2308.         mov     al,[si]
  2309.         mov     si,offset onmsg
  2310.         mov     cx,2            ; assume 2-byte 'ON' message
  2311.         or      al,al           ; test value
  2312.         jnz     onof1           ; on, have right msg
  2313.         mov     si,offset offmsg
  2314.         mov     cx,3
  2315. onof1:  rep     movsb           ; copy right message in
  2316.         ret
  2317. onoff   endp
  2318.  
  2319. ; print first message if false, second if true
  2320. msg2    proc    near
  2321.         call    stval           ; get value cell
  2322.         mov     al,[si]
  2323.         mov     si,[bx].msg     ; assume off
  2324.         or      al,al           ; is it?
  2325.         jz      msg21           ; yes, continue
  2326.         mov     si,[bx].val2    ; else use alternate message
  2327. msg21:  jmp     stms1           ; handle copy and return
  2328. msg2    endp
  2329.  
  2330. ; search a keyword table for a value, print that value
  2331. srchkw  proc    near
  2332.         call    stmsg           ; first print message
  2333.         call    stval
  2334.         mov     al,[si]         ; get value to hunt for
  2335.         mov     ah,0            ; high order is 0
  2336.         mov     bx,[bx].val2    ; this is table address
  2337.         jmp     prttab          ; and look in table
  2338. srchkw  endp
  2339.  
  2340. ; search a keyword table for a bit value, print that value. [jrd]
  2341. srchkb  proc    near
  2342.         call    stmsg                   ; first print message
  2343.         call    stbval                  ; get bit set or reset
  2344.         mov     ah,0                    ; al has 0/1, high order is 0
  2345.         mov     bx,[bx].val2            ; this is table address
  2346.         jmp     prttab                  ; and look in table
  2347. srchkb  endp
  2348.  
  2349. ; get address of test value in stent.  Returns address in si. [jrd]
  2350. stbval  proc    near
  2351.         mov     si,[bx].basval          ; get address of test value
  2352.         cmp     si,0                    ; any there?
  2353.         je      stbva1                  ; no, quit with no match
  2354.         mov     ax,[si]                 ; get value
  2355.         test    ax,[bx].tstcel          ; bit test value against data word
  2356.         jz      stbva1                  ; z = they don't match
  2357.         mov     ax,1                    ;  match
  2358.         ret
  2359. stbva1: mov     ax,0                    ; no match
  2360.         ret                             ; and return it
  2361. stbval  endp
  2362.  
  2363.  
  2364. ; Print the drive name
  2365. drnum   proc    near
  2366.         call    stmsg           ; copy message part first
  2367.         call    stval           ; pick up test value address
  2368.         mov     ah,gcurdsk      ; Get current disk
  2369.         int     dos
  2370.         inc     al              ; We want 1 == A (not zero)
  2371.         mov     curdsk,al
  2372.         add     al,'@'          ; Make it printable
  2373.         cld
  2374.         stosb
  2375.         mov     word ptr [di],'\:'
  2376.         add     di,2            ; end with a colon and backslash
  2377.         mov     byte ptr [di],0 ; terminate in case drive is not ready
  2378.         mov     dl,0            ; get current drive
  2379.         mov     ah,gcd          ; get current directory
  2380.         mov     si,di           ; current working buffer position
  2381.         int     dos
  2382.         push    cx
  2383.         push    dx
  2384.         mov     dx,di           ; directory string
  2385.         call    strlen          ; length of path part to cx
  2386.         cmp     cx,26           ; too long to show the whole thing?
  2387.         jbe     drnum3          ; be = is ok, show the whole path
  2388.         push    di              ; scan backward for last backslash
  2389.         mov     al,'\'          ; thing to search for
  2390.         std                     ; backward
  2391.         mov     di,si           ; start of buffer
  2392.         add     di,cx           ; length of string
  2393.         repne   scasb           ; scan backward for a backslash
  2394.         jcxz    drnum2          ; should not happen, but then again
  2395.         repne   scasb           ; do again for second to last path part
  2396. drnum2: cld                     ; reset direction flag
  2397.         dec     di              ; move di two places preceding backslash
  2398.         mov     [di],'--'       ; insert a missing path indicator
  2399.         dec     di
  2400.         mov     byte ptr [di],'-'
  2401.         mov     si,di           ; we will show just this part
  2402.         pop     di              ; recover main status pointer
  2403. drnum3: pop     dx
  2404.         pop     cx
  2405.  
  2406. drnum4: lodsb                   ; copy until null terminator
  2407.         stosb
  2408.         cmp     al,0            ; end of string?
  2409.         jne     drnum4          ; ne = no
  2410.         dec     di              ; offset inc of stosb
  2411.         ret
  2412. drnum   endp
  2413.  
  2414.  
  2415. ; Print the screen-dump filename [jrd]
  2416.  
  2417. pasz    proc    near
  2418.         call    stmsg           ; copy message part
  2419.         mov     si,[bx].val2    ; address of asciiz string
  2420. pasz1:  lodsb                   ; get a byte
  2421.         cmp     al,0            ; at end yet?
  2422.         je      pasz2           ; e = yes
  2423.         stosb                   ; store in buffer
  2424.         jmp     short pasz1     ; keep storing non-null chars
  2425. pasz2:  ret
  2426. pasz    endp
  2427.  
  2428. ; print the End-of-Line characters
  2429. preol   proc    near
  2430.         call    stmsg           ; display leadin part of message
  2431.         mov     al,dtrans.seol  ; send eol char
  2432.         add     al,40H          ; make it printable
  2433.         stosb
  2434.         mov     si,offset mseol2 ; second part of message
  2435.         call    stms1           ; add that
  2436.         mov     al,trans.reol   ; receive eol char
  2437.         add     al,40H          ; make it printable
  2438.         stosb
  2439.         ret
  2440. preol   endp
  2441.  
  2442. ; print Send Delay and Pause
  2443. prsnd   proc    near
  2444.         call    stmsg           ; display leadin part of msg
  2445.         mov     al,trans.sdelay ; Send Delay (sec)
  2446.         xor     ah,ah
  2447.         call    outnum
  2448.         mov     si,offset sndmsg2 ; second part of msg
  2449.         call    stms1           ; add that
  2450.         mov     al,spause       ; Send Pause (millisec)
  2451.         call    outnum
  2452.         mov     si,offset sndmsg3 ; last part of msg
  2453.         call    stms1           ; add it too
  2454.         ret
  2455. prsnd   endp
  2456.  
  2457. ; Print the handshake
  2458. prhnd:  mov     si,offset handst        ; copy in initial message
  2459.         call    stms1
  2460.         mov     si,offset nonmsg        ; assume no handshake
  2461.         mov     bx,portval
  2462.         cmp     [bx].hndflg,0           ; Is handshaking in effect?
  2463.         jne     prh0                    ; Yes, print what we're using
  2464.         jmp     stms1                   ; no, say so and return
  2465. prh0:   mov     al,5eh                  ; Doing handshaking with control char
  2466.         stosb
  2467.         mov     al,[bx].hands
  2468.         add     al,40H                  ; Make printable
  2469.         stosb                           ; put in buffer
  2470.         ret                             ; and return
  2471.  
  2472. ; Print the pad character in AL
  2473. prpad:  cmp     al,127                  ; Are they using a delete?
  2474.         jne     prpad0
  2475.         mov     ah,prstr
  2476.         mov     dx,offset delmsg
  2477.         int     dos
  2478.         ret
  2479. prpad0: mov     dl,5eh                  ; caret
  2480.         mov     ah,conout
  2481.         push    ax
  2482.         int     dos
  2483.         pop     ax
  2484.         mov     dl,al
  2485.         add     dl,40H                  ; Make printable
  2486.         int     dos
  2487.         ret
  2488.  
  2489. ; Print value from table.  BX/address of table, AL/value of variable
  2490. prttab: push    cx                      ; save column count
  2491.         mov     cl,[bx]                 ; Number of entries in our table
  2492.         inc     bx                      ; Point to the data
  2493. prtt0:  mov     dl,[bx]                 ; Length of keyword
  2494.         inc     bx                      ; Point to keyword
  2495.         mov     dh,0
  2496.         inc     dx                      ; Account for "$" in table
  2497.         mov     si,dx                   ; Put to index register
  2498.         cmp     ax,[bx+si]              ; Is this the one?
  2499.         je      prtt1
  2500.         add     bx,dx                   ; Go to end of keyword
  2501.         add     bx,2                    ; Point to next keyword
  2502.         dec     cl                      ; Any more keywords to check?
  2503.         jnz     prtt0                   ; Yes, go to it
  2504.         mov     bx,offset prterr
  2505. prtt1:  mov     si,bx
  2506.         pop     cx                      ; recover column count
  2507.         jmp     stms1                   ; copy in message
  2508.  
  2509. ; Print the baud rate
  2510.  
  2511. BAUDPRT PROC     NEAR
  2512.         mov     si,offset baudrt        ; "Baud rate is"
  2513.         call    stms1                   ; display that part
  2514.         call    getbaud                 ; read baud rate first
  2515.         mov     bx,portval
  2516.         mov     ax,[bx].baud
  2517.         cmp     al,byte ptr bdtab       ; number of table entries
  2518.         jb      bdprt5                  ; b = in table
  2519.         mov     si,offset unrec         ; say unrecognized value
  2520.         jmp     stms1                   ; display text and return
  2521. bdprt5: mov     bx,offset bdtab         ; show ascii rate from table
  2522.         call    prttab
  2523.         ret
  2524. BAUDPRT ENDP
  2525.  
  2526. ; display Take/Macro COUNT
  2527. stcnt   proc    near
  2528.         call    stmsg                   ; display leadin part of msg
  2529.         cmp     taklev,0                ; in a Take file or macro?
  2530.         jne     stcnt1                  ; ne = yes
  2531.         mov     si,offset nonemsg       ; say none
  2532.         call    stms1
  2533.         ret
  2534. stcnt1: push    bx
  2535.         mov     bx,takadr               ; current Take structure
  2536.         mov     ax,[bx].takctr          ; get COUNT
  2537.         pop     bx
  2538.         call    outnum
  2539.         ret
  2540. stcnt   endp
  2541.  
  2542. ; ALARM time
  2543. stalr   proc    near
  2544.         call    stmsg                   ; display leading part of msg
  2545.         push    bx                      ; preserve register
  2546.         mov     bx,0                    ; position index
  2547. stalr1: push    bx                      ; save around calls
  2548.         cmp     alrhms[bx],10           ; two digits?
  2549.         jae     stalr2                  ; ae = yes
  2550.         mov     al,'0'
  2551.         stosb                           ; show leading zero
  2552. stalr2: mov     al,alrhms[bx]           ; show time component
  2553.         mov     ah,0
  2554.         call    outnum
  2555.         pop     bx                      ; recover index
  2556.         inc     bx
  2557.         cmp     bx,3                    ; done all fields?
  2558.         jae     stalr3                  ; ae = yes
  2559.         mov     al,':'
  2560.         stosb
  2561.         jmp     short stalr1            ; do next field
  2562. stalr3: pop     bx
  2563.         ret
  2564. stalr   endp
  2565.  
  2566. ; Jumping to this location is like retskp.    It assumes the instruction
  2567. ;    after the call is a jmp addr
  2568.  
  2569. RSKP    PROC    NEAR
  2570.         pop     bp
  2571.         add     bp,3
  2572.         push    bp
  2573.         ret
  2574. RSKP    ENDP
  2575.  
  2576. ; Jumping here is the same as a ret
  2577.  
  2578. R       PROC    NEAR
  2579.         ret
  2580. R       ENDP
  2581.  
  2582. ; routine to print an error message, then retskp
  2583. ; expects message in dx
  2584. reterr  proc    near
  2585.         mov     ah,prstr
  2586.         int     dos
  2587.         jmp     rskp
  2588. reterr  endp
  2589.  
  2590. code    ends
  2591.  
  2592. ;; Additional data segment material placed here to aid MASM 4
  2593. datas   segment public 'datas'
  2594. ermes1  db      cr,lf,'?Too many macro names$'
  2595. ermes2  db      cr,lf,bell,'?No room for Take file buffer or Macro definition'
  2596.         db      cr,lf,bell,'$'
  2597. ermes4  db      cr,lf,'?Too many active Take files and Macros',cr,lf, bell,'$'
  2598. ermes5  db      cr,lf,'?Not implemented$'
  2599. ermes6  db      cr,lf,'?More parameters are needed$'
  2600. ermes7  db      cr,lf,'?Command not executed$'
  2601. errcap  db      cr,lf,'?Unable to open that file$'
  2602. erropn  db      cr,lf,'?Log file is already open$'
  2603. askhlp1 db      'Variable name  then  prompt string$'
  2604. askhlp2 db      'Prompt string$'
  2605. askhlp3 db      'Enter a line of text$'
  2606. filhlp  db      ' Output filename for the log$'
  2607. dishlp  db      cr,lf,' Quiet (no screen writing), Regular (normal),'
  2608.         db      ' Serial (non-formatted screen)'
  2609.         db      cr,lf,' and/or 7-BIT (default) or 8-BIT wide characters.$'
  2610. remhlp  db      cr,lf,' OFF to show file transfer display,'
  2611.         db      ' ON for quiet screen$'
  2612. macmsg  db      ' Specify macro name followed by body of macro, on same line$'
  2613. shmmsg  db      ' name of macro, or carriage return to see all$'
  2614. prmmsg  db      cr,lf
  2615.         db    ' Enter new prompt string or nothing to regain regular prompt.'
  2616.         db      cr,lf,' Use \123 notation for special chars (Escape is \27)$'
  2617.  
  2618. srxhlp1 db      cr,lf,' Enter   code for received byte   code for'
  2619.         db      ' local byte ',cr,lf,' use ascii characters themselves or'
  2620.         db      cr,lf,' numerical equivalents of  \nnn  decimal'
  2621.         db      ' or \Onnn  octal or \Xnnn  hexadecimal',cr,lf
  2622.         db      ' or keywords  ON  or  OFF  (translation is initially off)'
  2623.         db      cr,lf,'$'
  2624. shormsg db      cr,lf,' Translation table of received byte codes while'
  2625.         db      ' in CONNECT mode -'
  2626.         db      cr,lf,' Format: [received byte (decimal) -> local byte'
  2627.         db      ' (decimal)]',cr,lf,'$'
  2628. shopm1  db      ' [\$'                  ; Show Translation material
  2629. shopm2  db      ' -> \$'
  2630. shopm3  db      '] $'
  2631. badrx   db      cr,lf,'?Expected ON, OFF, or \nnn$'
  2632. rxoffmsg db     cr,lf,' Input Translation is off$'
  2633. rxonmsg db      cr,lf,' Input Translation is on$'
  2634. rxtable equ THIS BYTE           ; build 256 byte Translation Input table
  2635.         maketab                 ; table rxtable is used by Connect mode
  2636. stkadr  dw      0       ; non-zero if replacement keyboard xlator present
  2637. prterr  db      '?Unrecognized value$'
  2638. takchlp db      cr,lf,'Value 0 to 65535 for COUNT in script IF COUNT command$'
  2639. takcerr db      cr,lf,'?Note: command is valid only in Take files and Macros$'
  2640. defpmp  db      'Definition string: $'
  2641. nonmsg  db      'none$'
  2642. delmsg  db      'delete$'
  2643. onmsg   db      'on'
  2644. offmsg  db      'off'
  2645. logmsg  db      'Logging of Packets, Session, Transaction, plus'
  2646.         db      ' screen dump file -$'
  2647. lpktnam db      'PACKET.LOG',54 dup (0) ; default packet log filename
  2648. lsesnam db      'KERMIT.LOG',54 dup (0) ; default capture/session filename
  2649. ltranam db      'TRANSACT.LOG',52 dup (0); default transaction log filename
  2650. dmpdefnam db    'KERMIT.SCN',0          ; asciiz default screen dump filename
  2651. dmpname db      'KERMIT.SCN',54 dup (0) ; file name for screen dumps [jrd]
  2652. lsesmsg db      'Session log:     $'
  2653. lpktmsg db      'Packet log:      $'
  2654. ltramsg db      'Transaction log: $'
  2655. dmpmsg  db      'Dump screen:     $'
  2656. dmpmsg2 db      'Dump screen: $'        ; for general STATUS display
  2657. tmp     db      ?,'$'
  2658. modst   db      'Mode line: $'
  2659. locst   db      'Local echo: $'
  2660. belon   db      'Ring bell after transfer$'
  2661. beloff  db      'No bell after transfer$'
  2662. vtemst  db      'Terminal emulation: $'         ; terminal emulator
  2663. portst  db      'Communications port: $'
  2664. capmsg  db      'Logging: $'
  2665. eofmsg  db      'EOF mode: $'
  2666. flost   db      'No flow control used$'
  2667. floxmsg db      'Flow control: xon/xoff $'
  2668. handst  db      'Handshake used: $'
  2669. destst  db      'File destination: $'
  2670. diskst  db      'Path: $'
  2671. blokst  db      'Block check used: $'
  2672. sqcst   db      'Send control char prefix: $'
  2673. rqcst   db      'Receive control char prefix: $'
  2674. debon   db      'Debug: $'
  2675. flwon   db      'Warning (filename change): $'
  2676. parmsg  db      'Parity: $'
  2677. abfdst  db      'Discard incomplete file$'
  2678. abfkst  db      'Keep incomplete file$'
  2679. sndmsg  db      'Send Delay: $'
  2680. sndmsg2 db      ' sec, Pause: $'
  2681. sndmsg3 db      ' ms$'
  2682. ssohst  db      'Send start-of-packet char: $'
  2683. rsohst  db      'Receive start-of-packet char: $'
  2684. meolst  db      'End-of-Line char  S: ',5eh,'$'
  2685. mseol2  db      '  R: ',5eh,'$'
  2686. stimst  db      'Send timeout (seconds): $'
  2687. rtimst  db      'Receive timeout (seconds): $'
  2688. spakst  db      'Send packet size: $'
  2689. rpakst  db      'Receive packet size: $'
  2690. snpdst  db      '# of send padding chars: $'
  2691. rnpdst  db      '# of receive padding chars: $'
  2692. spadst  db      'Padding char: $'
  2693. retrymsg db     'Retry send/receive packet limit: $'
  2694. dispst  db      'Display (vs Remote):$'
  2695. remost  db      'Remote (vs Display) $'
  2696. timmsg  db      'Timer: $'
  2697. srvmsg  db      'Timeout (sec) waiting for a transaction: $'
  2698. srvthlp db      'seconds, 0-255, waiting for a transaction$'
  2699. escmes  db      'Escape character: $'
  2700. scpmsg  db      'Script commands Echo, If, Input, Output, Pause, Reinput,'
  2701.         db      ' Transmit, Wait$'
  2702. sechmsg db      'Input echoing: $'
  2703. scasmsg db      'Case sensitivity: $'
  2704. stmo1msg db     'Timeout (seconds): $'
  2705. stmo2msg db     'Timeout-action: $'
  2706. takon   db      'Take-echo: $'
  2707. atton   db      'Attributes pkts: $'
  2708. baudrt  db      'Baud rate is $'
  2709. unrec   db      'unknown$'
  2710. stcntmsg db     'Take/Macro COUNT: $'
  2711. nonemsg db      'no active Take/Macro$'
  2712. sterlmsg db     'Errorlevel: $'
  2713. stalrmsg db     'Alarm time: $'
  2714. nummsg1 db      cr,lf,'?Use a number between $'
  2715. nummsg2 db      ' and $'
  2716. ctlhlp  db      ' Decimal number between 0 and 31$'
  2717. dmphlp  db      ' Filename to hold screen dumps$'
  2718. erlhlp  db      ' Decimal number between 0 and 255$'
  2719. pakerr  db      cr,lf,'?Choose a decimal number '
  2720.         db      'from 20 to 94 (normal) or to 1000 (long)$'
  2721. pakhlp  db      cr,lf,'Decimal number between 20 and 94 (normal) or '
  2722.         db      '1000 (long)$'
  2723. padhlp  db      cr,lf,' Decimal number between 0 and 31 or 127$'
  2724. pauhlp  db      ' Decimal number between 0 and 127$'
  2725. quohlp  db      ' Decimal number between 33 and 126$'
  2726. retryhlp db     ' Decimal number between 1 and 63$'
  2727. timhlp  db      ' Decimal number between 0 and 94$'
  2728. delyhlp db      ' Delay seconds before sending file (0-63)$'
  2729. eschlp  db      cr,lf,'Press literal control keys (ex: Control ]) or'
  2730.         db      ' enter in \nnn numerical form$'
  2731. escerr  db      cr,lf,'?Not a control code$'
  2732. hnd1hlp db      cr,lf,'XON (\17), XOFF (\19), CR (\13), LF (\10), BELL (\7),'
  2733.         DB      ' ESC (\27), NONE (\0)'
  2734.         db      cr,lf,' or "CODE" followed by decimal number$'
  2735. intoms  db      'number of seconds to wait before timeout',cr,lf,'$'
  2736. loghlp  db      cr,lf
  2737.         db     ' PACKET - during file transfers  (to default file PACKET.LOG)'
  2738.         db      cr,lf
  2739.         db     ' SESSION - during Connect mode   (to default file KERMIT.LOG)'
  2740.         db      cr,lf
  2741.         db     ' TRANSACTION - files transferred (to default file TRANSACT.LOG)'
  2742.         db      cr,lf,'  followed by an optional filename for the log.$'
  2743. debhlp  db      cr,lf,' PACKETS - during file transfers'        ; Debugging
  2744.         db      cr,lf,' SESSION - during Connect mode'
  2745.         db      cr,lf,' ON - both packets and session'
  2746.         db      cr,lf,' OFF - turns off all debugging$'
  2747. dohlp   db      cr,lf,'definitions of variables (\%n), or carriage return$'
  2748.  
  2749. sdshlp  db      cr,lf,'DISABLE or ENABLE access to selected Server commands:'
  2750.         db      cr,lf
  2751.         db      ' CD/CWD, DEL, DIR, FIN (incl BYE & LOGO), GET, HOST, MESSAGE,'
  2752.         db      ' SPACE, TYPE,',cr,lf,' and ALL.'
  2753.         db      cr,lf,'Also TEK (automatic invokation of Tek4010 graphics);'
  2754.         db      ' not a member of ALL.$'
  2755. servmsg db      'Server commands available to remote user: $'
  2756. scwdmsg db      'CD/CWD: $'
  2757. sdelmsg db      'DELETE: $'
  2758. sdirmsg db      'DIR:    $'
  2759. sfinmsg db      'FINISH: $'
  2760. sgetmsg db      'GET:    $'
  2761. shstmsg db      'HOST:   $'
  2762. ssndmsg db      'MESSAGE:$'
  2763. sspcmsg db      'SPACE:  $'
  2764. stypmsg db      'TYPE:   $'
  2765. stekmsg db      'Tek4010: $'
  2766.  
  2767. srvtab  db      1                       ; SET SERVER table
  2768.         mkeyw   'Timeout',1
  2769.  
  2770. sethlp  db      cr,lf
  2771.         db      '  Alarm    sec from now or HH:MM:SS  '
  2772.         db      '  Input timeout, etc  (for scripts)'
  2773.         db      cr,lf
  2774.         db      '  Attributes packets on/off          '
  2775.         db      '  Key         key-ident   definition'
  2776.         db      cr,lf
  2777.         db      '  Baud or Speed     many speeds      '
  2778.         db      '  Local-echo        on/off'
  2779.         db      cr,lf
  2780.         db      '  Bell    on/off    at end of xfers  '
  2781.         db      '  Mode-line         on/off'
  2782.         db      cr,lf
  2783.         db      '  Block-check-type  checksum/CRC     '
  2784.         db      '  Parity    even/odd/mark/space/none'
  2785.         db      cr,lf
  2786.         db      '  COUNT   number    a loop counter   '
  2787.         db      '  Port for i/o      1/2/COM1/COM2/etc'
  2788.         db      cr,lf
  2789.         db      '  Debug   on/off    display packets  '
  2790.         db      '  Prompt  string   (new Kermit prompt)'
  2791.         db      cr,lf
  2792.         db      '  Default-disk                       '
  2793.         db      '  Receive parameter  many things'
  2794.         db      cr,lf
  2795.         db      '  Delay   secs  before Sending file  '
  2796.         db      '  Remote    on/off  show xfer counts?'
  2797.         db      cr,lf
  2798.         db      '  Destination   Disk/Screen/Printer  '
  2799.         db      '  Retry limit for packet send/receive'
  2800.         db      cr,lf
  2801.         db      '  Display quiet/reg/serial show cnts?'
  2802.         db      '  Send parameter    many things'
  2803.         db      cr,lf
  2804.         db      '  Dump filespec     screen to disk   '
  2805.         db      '  Server parameter'
  2806.         db      cr,lf
  2807.         db      '  End-of-line char  cr or whatever   '
  2808.         db      '  Speed or baud     many speeds      '
  2809.         db      cr,lf
  2810.         db      '  EOF Ctrl-Z/NoCtrl-Z  ~Z ends file? '
  2811.         db      '  Take-echo on/off  display commands?'
  2812.         db      cr,lf
  2813.         db      '  Errorlevel number   for DOS Batch  '
  2814.         db      '  Terminal  none, Heath-19, VT52, VT102,'
  2815.         db      cr,lf
  2816.         db      '  Escape char  ~]   or whatever      '
  2817.         db      '     and many terminal setup parameters'
  2818.         db      cr,lf
  2819.         db      '  Flow-control      xon-xoff or none '
  2820.         db      '  Timer     on/off  time packet waiting'
  2821.         db      cr,lf
  2822.         db      '  Handshake xon/xoff/cr/lf/bell/esc..'
  2823.         db      "  Translation IN  Connect mode rcv'd char"
  2824.         db      cr,lf
  2825.         db      '  Incomplete file   keep/discard     '
  2826.         db      '  Warning   on/off  if file renamed'
  2827.         db      cr,lf,'$'
  2828.  
  2829. settab   db     37                                      ; Set table
  2830.         mkeyw   'Alarm',setalrm
  2831.         mkeyw   'Attributes',setatt
  2832.         mkeyw   'Baud',baudst
  2833.         mkeyw   'Bell',bellst
  2834.         mkeyw   'Block-check-type',blkset
  2835.         mkeyw   'Count',takectr
  2836.         mkeyw   'Debug',debst
  2837.         mkeyw   'Default-disk',cwdir
  2838.         mkeyw   'Delay',setdely
  2839.         mkeyw   'Destination',desset
  2840.         mkeyw   'Display',disply
  2841.         mkeyw   'Dump',setdmp
  2842.         mkeyw   'End-of-Line',eolset
  2843.         mkeyw   'EOF',seteof
  2844.         mkeyw   'Errorlevel',seterl
  2845.         mkeyw   'Escape',escset
  2846.         mkeyw   'Flow-control',floset
  2847.         mkeyw   'Handshake',hndset
  2848.         mkeyw   'Incomplete',abfset
  2849.         mkeyw   'Input',inpset
  2850.         mkeyw   'Key',setkey
  2851.         mkeyw   'Local-echo',lcal
  2852.         mkeyw   'Mode-line',modl
  2853.         mkeyw   'Parity',setpar
  2854.         mkeyw   'Port',coms
  2855.         mkeyw   'Prompt',promset
  2856.         mkeyw   'Receive',recset
  2857.         mkeyw   'Remote',remset
  2858.         mkeyw   'Retry',retryset
  2859.         mkeyw   'Send',sendset
  2860.         mkeyw   'Server',setsrv
  2861.         mkeyw   'Speed',baudst
  2862.         mkeyw   'Take-echo',takset
  2863.         mkeyw   'Terminal',vts
  2864.         mkeyw   'Timer',timset
  2865.         mkeyw   'Translation',setrx
  2866.         mkeyw   'Warning',filwar
  2867.  
  2868.  
  2869. seoftab db      2
  2870.         mkeyw   'Ctrl-Z',1
  2871.         mkeyw   'NoCtrl-Z',0
  2872.  
  2873. stsrtb  db      8                               ; Number of options
  2874.         mkeyw   'Packet-length',srpack
  2875.         mkeyw   'Padchar',srpad
  2876.         mkeyw   'Padding',srnpd
  2877.         mkeyw   'Pause',srpaus
  2878.         mkeyw   'Start-of-packet',srsoh
  2879.         mkeyw   'Quote',srquo
  2880.         mkeyw   'End-of-Line',sreol
  2881.         mkeyw   'Timeout',srtim
  2882.  
  2883. ontab   db      2
  2884.         mkeyw   'off',0
  2885.         mkeyw   'on',1
  2886.  
  2887. modtab  db      3                               ; Mode line status
  2888.         mkeyw   'off',0
  2889.         mkeyw   'on',1
  2890.         mkeyw   'on (owned by host)',2
  2891.  
  2892.  
  2893. destab  db      3
  2894.         mkeyw   'Disk',1
  2895.         mkeyw   'Printer',0
  2896.         mkeyw   'Screen',2
  2897.  
  2898. distab  db      5                       ; Set Display mode
  2899.         mkeyw   '7-bit',7               ; controls bit d8bit in flags.remflg
  2900.         mkeyw   '8-bit',8               ; sets d8bit
  2901.         mkeyw   'Quiet',dquiet          ; values defined in header file
  2902.         mkeyw   'Regular',dregular
  2903.         mkeyw   'Serial',dserial
  2904.  
  2905. dissta  db      6                       ; Status of Display mode [jrd]
  2906.         mkeyw   'Quiet, 7-bit',dquiet
  2907.         mkeyw   'Regular, 7-bit',dregular
  2908.         mkeyw   'Serial, 7-bit',dserial
  2909.         mkeyw   'Quiet, 8-bit',dquiet+d8bit
  2910.         mkeyw   'Regular, 8-bit',dregular+d8bit
  2911.         mkeyw   'Serial, 8-bit',dserial+d8bit
  2912.  
  2913. ; What type of block check to use
  2914. blktab  db      3
  2915.         mkeyw   '1-character-checksum',1
  2916.         mkeyw   '2-character-checksum',2
  2917.         mkeyw   '3-character-CRC-CCITT',3
  2918.  
  2919. ; If abort when receiving files, can keep what we have or discard
  2920.  
  2921. abftab  db      2
  2922.         mkeyw   'Discard',1
  2923.         mkeyw   'Keep',0
  2924.  
  2925. partab  db      5
  2926.         mkeyw   'none',PARNON
  2927.         mkeyw   'even',PAREVN
  2928.         mkeyw   'odd',PARODD
  2929.         mkeyw   'mark',PARMRK
  2930.         mkeyw   'space',PARSPC
  2931.  
  2932. flotab  db      2
  2933.         mkeyw   'none',flonon
  2934.         mkeyw   'xon/xoff',floxon
  2935.  
  2936. hndtab  db      8
  2937.         mkeyw   'none',0
  2938.         mkeyw   'bell',bell
  2939.         mkeyw   'cr',cr
  2940.         mkeyw   'esc',escape
  2941.         mkeyw   'lf',lf
  2942.         mkeyw   'xoff',xoff
  2943.         mkeyw   'xon',xon
  2944.         mkeyw   'code',0ffh             ; allow general numerial code
  2945.  
  2946. inptab  db      4                               ; Scripts. Set Input
  2947.         mkeyw   'Case',inpcas                   ;[jrs]
  2948.         mkeyw   'Default-timeout',inptmo        ;[jrs]
  2949.         mkeyw   'Echo',inpeco                   ;[jrs]
  2950.         mkeyw   'Timeout-action',inpact         ;[jrs]
  2951.  
  2952. inactb  db      2                               ; Set Input Timeout Action
  2953.         mkeyw   'Proceed',0                     ;[jrs]
  2954.         mkeyw   'Quit',1                        ;[jrs]
  2955.  
  2956. incstb  db      2                               ;[jrs] Set Input Case
  2957.         mkeyw   'Ignore',0dfh                   ;[jrs]
  2958.         mkeyw   'Observe',0ffh                  ;[jrs]
  2959.  
  2960.  
  2961. bdtab   db      18                      ; Baud rate table
  2962.         mkeyw   '45.5',b00455
  2963.         mkeyw   '50',b0050
  2964.         mkeyw   '75',b0075
  2965.         mkeyw   '110',b0110
  2966.         mkeyw   '134.5',b01345
  2967.         mkeyw   '150',b0150
  2968.         mkeyw   '300',b0300
  2969.         mkeyw   '600',b0600
  2970.         mkeyw   '1200',b1200
  2971.         mkeyw   '1800',b1800
  2972.         mkeyw   '2000',b2000
  2973.         mkeyw   '2400',b2400
  2974.         mkeyw   '4800',b4800
  2975.         mkeyw   '9600',b9600
  2976.         mkeyw   '19200',b19200
  2977.         mkeyw   '38400',b38400
  2978.         mkeyw   '57600',b57600
  2979.         mkeyw   '115200',b115200
  2980.  
  2981. debtab  db      4                       ; Set Debug command
  2982.         mkeyw   'Off',0
  2983.         mkeyw   'On',logpkt+logses
  2984.         mkeyw   'Packets',logpkt
  2985.         mkeyw   'Session',logses
  2986.  
  2987. logtab  db      3                       ; LOG command
  2988.         mkeyw   'Packets',logpkt
  2989.         mkeyw   'Session',logses
  2990.         mkeyw   'Transaction',logtrn
  2991.  
  2992. logsta  db      8                       ; Log Status table
  2993.         mkeyw   'off',logoff            ; suspended or no logging
  2994.         mkeyw   'Packet',logpkt
  2995.         mkeyw   'Session',logses
  2996.         mkeyw   'Packet+Session',logpkt+logses
  2997.         mkeyw   'Transaction',logtrn
  2998.         mkeyw   'Packet+Transaction',logpkt+logtrn
  2999.         mkeyw   'Session+Transaction',logses+logtrn
  3000.         mkeyw   'Packet+Session+Transaction',logpkt+logses+logtrn
  3001.  
  3002. srvdetab db     12                      ; Server Enable/Disable list
  3003.         mkeyw   'All',01ffh
  3004.         mkeyw   'CD',cwdflg
  3005.         mkeyw   'CWD',cwdflg
  3006.         mkeyw   'Delete',delflg
  3007.         mkeyw   'Dir',dirflg
  3008.         mkeyw   'Finish',finflg
  3009.         mkeyw   'Get',getsflg
  3010.         mkeyw   'Host',hostflg
  3011.         mkeyw   'Message',sndflg
  3012.         mkeyw   'Space',spcflg
  3013.         mkeyw   'Type',typflg
  3014.         mkeyw   'Tek4010',tekxflg       ; for automatic Tektronix invokation
  3015.  
  3016. endistab db     2                       ; Server ENABLE/DISABLE status
  3017.         mkeyw   'enabled',0
  3018.         mkeyw   'disabled',1
  3019.  
  3020. trnstab db      1                       ; Set Translation table
  3021.         mkeyw   'Input',1
  3022.  
  3023. ; MACRO DATA STRUCTURES mcctab and macbuf
  3024. mcctab  db      1                       ; macro name table, one initially
  3025.         mkeyw   'IBM',ibmmac            ; offset of definition string (7 bytes)
  3026.         db      (macmax*10 - 7) dup (?) ; room for rest of macro names
  3027. mcclen  equ     $-mcctab                ; length of mcctab
  3028.  
  3029. mccptr  dw      mcctab + 8              ; ptr to first free byte in mcctab
  3030.  
  3031. macbuf  equ     this byte               ; buffer of macro strings
  3032. ibmmac  db      ibmlen                  ; startup IBM macro definition
  3033.         db      'set timer on',cr,'set parity mark',cr
  3034.         db      'set local-echo on',cr,'set handshake xon',cr
  3035.         db      'set flow none',cr
  3036. ibmlen  equ     $-ibmmac-1
  3037.         db      (macmax*60 -ibmlen-1) dup (?) ; space for additonal macro defs
  3038. maclen  equ     $ - macbuf              ; length of macbuf
  3039.  
  3040. macptr  dw      macbuf+ibmlen+1         ; ptr to first free byte in macbuf
  3041. ; END OF MACRO DATA STRUCTURES
  3042.  
  3043. shom9m1 db      cr,lf,' Free space (bytes) for names: $'
  3044. shom9m2 db      ', for definitions: $'
  3045. shom9m3 db      cr,lf,' No macro(s)$'
  3046. shom9m4 db      '<cr>$'
  3047.  
  3048. sttab   stent   <baudprt>                               ; STATUS
  3049.         stent   <srchkw,vtemst,termtb,flags.vtflg>      ; terminal emulator
  3050.         stent   <srchkw,portst,comptab,flags.comflg>
  3051.         stent   <srchkw,modst,modtab,flags.modflg>
  3052.         stent   <srchkw,parmsg,partab,parflg,portval>
  3053.         stent   <prsnd, sndmsg>
  3054.         stent   <onoff,locst,,ecoflg,portval>
  3055.         stent   <stnum,stimst,,dtrans.stime>
  3056.         stent   <msg2,flost,floxmsg,floflg,portval>
  3057.         stent   <onechr,ssohst,,trans.ssoh>
  3058.         stent   <prhnd>
  3059.         stent   <stlnum,spakst,,trans.slongp>
  3060.         stent   <drnum,diskst,,curdsk>
  3061.         stent   <stnum,snpdst,,dtrans.spad>
  3062.         stent   <srchkw,destst,destab,flags.destflg>
  3063.         stent   <onechr,sqcst,,trans.rquote>
  3064.         stent   <onoff,flwon,,flags.flwflg>
  3065.         stent   <stnum,rtimst,,trans.rtime>
  3066.         stent   <msg2,abfkst,abfdst,flags.abfflg>
  3067.         stent   <onechr,rsohst,,trans.rsoh>
  3068.         stent   <srchkw,eofmsg,seoftab,flags.eofcz>
  3069.         stent   <stlnum,rpakst,,trans.rlongp>
  3070.         stent   <msg2,beloff,belon,flags.belflg>
  3071.         stent   <stnum,rnpdst,,trans.rpad>
  3072.         stent   <srchkw,capmsg,logsta,flags.capflg>
  3073.         stent   <onechr,rqcst,,dtrans.squote>
  3074.         stent   <onoff,timmsg,,flags.timflg>
  3075.         stent   <preol,meolst>
  3076.         stent   <srchkw,debon,logsta,flags.debug>
  3077.         stent   <stnum,retrymsg,,maxtry>
  3078.         stent   <onechr,escmes,,trans.escchr>
  3079.         stent   <srchkw,blokst,blktab,trans.chklen>
  3080.         stent   <srchkw,dispst,dissta,flags.remflg>
  3081.         stent   <pasz,dmpmsg2,offset dmpname>
  3082.         stent   <vtstat>
  3083.         dw      0                               ; end of table
  3084. stcom   stent   <srchkw,portst,comptab,flags.comflg>    ; SHOW COMMS
  3085.         stent   <baudprt>
  3086.         stent   <onoff,locst,,ecoflg,portval>
  3087.         stent   <srchkw,parmsg,partab,parflg,portval>
  3088.         stent   <prhnd>
  3089.         stent   <msg2,flost,floxmsg,floflg,portval>
  3090.         stent   <srchkw,dispst,dissta,flags.remflg>
  3091.         stent   <srchkw,debon,logsta,flags.debug>
  3092.         dw      0
  3093. stfile  stent   <drnum,diskst,,curdsk>                  ; SHOW FILE
  3094.         stent   <msg2,abfkst,abfdst,flags.abfflg>
  3095.         stent   <srchkw,destst,destab,flags.destflg>
  3096.         stent   <onoff,flwon,,flags.flwflg>
  3097.         stent   <srchkw,eofmsg,seoftab,flags.eofcz>
  3098.         stent   <onoff,takon,,flags.takflg>
  3099.         stent   <srchkw,dispst,dissta,flags.remflg>
  3100.         stent   <onoff,atton,,flags.attflg>
  3101.         dw      0
  3102. stlog   stent   <stmsg,logmsg>                          ; SHOW LOG
  3103.         stent   <srchkw,capmsg,logsta,flags.capflg>
  3104.         stent   <stmsg,spaces>
  3105.         stent   <pasz,lsesmsg,offset lsesnam>
  3106.         stent   <stmsg,spaces>
  3107.         stent   <pasz,lpktmsg,offset lpktnam>
  3108.         stent   <stmsg,spaces>
  3109.         stent   <pasz,ltramsg,offset ltranam>
  3110.         stent   <stmsg,spaces>
  3111.         stent   <pasz,dmpmsg,offset dmpname>
  3112.         dw      0
  3113.  
  3114. stpro   stent   <stlnum,spakst,,trans.slongp>           ; SHOW PROTOCOL
  3115.         stent   <stlnum,rpakst,,trans.rlongp>
  3116.         stent   <stnum,stimst,,dtrans.stime>
  3117.         stent   <stnum,rtimst,,trans.rtime>
  3118.         stent   <stnum,snpdst,,dtrans.spad>
  3119.         stent   <stnum,rnpdst,,trans.rpad>
  3120.         stent   <onechr,spadst,,dtrans.spadch>
  3121.         stent   <onechr,spadst,,trans.rpadch>
  3122.         stent   <onechr,ssohst,,trans.ssoh>
  3123.         stent   <onechr,rsohst,,trans.rsoh>
  3124.         stent   <onechr,sqcst,,dtrans.squote>
  3125.         stent   <onechr,rqcst,,trans.rquote>
  3126.         stent   <preol,meolst>
  3127.         stent   <stnum,retrymsg,,maxtry>
  3128.         stent   <prsnd,sndmsg>
  3129.         stent   <srchkw,blokst,blktab,trans.chklen>
  3130.         stent   <onoff,atton,,flags.attflg>
  3131.         stent   <prhnd>
  3132.         stent   <onoff,timmsg,,flags.timflg>
  3133.         stent   <srchkw,capmsg,logsta,flags.capflg>
  3134.         stent   <srchkw,debon,logsta,flags.debug>
  3135.         dw      0
  3136.  
  3137. stscpt  stent   <stmsg,scpmsg>                          ; SHOW SCRIPT
  3138.         stent   <onoff,sechmsg,,script.inecho>
  3139.         stent   <srchkw,scasmsg,incstb,script.incasv>
  3140.         stent   <stlnum,stmo1msg,,script.indfto>
  3141.         stent   <srchkw,stmo2msg,inactb,script.inactv>
  3142.         stent   <stalr,stalrmsg>
  3143.         stent   <stnum,sterlmsg,,errlev>
  3144.         stent   <stcnt,stcntmsg>
  3145.         dw      0
  3146. stserv  stent   <stmsg,servmsg>                         ; SHOW SERVER
  3147.         stent   <srchkb,scwdmsg,endistab,cwdflg,denyflg>
  3148.         stent   <srchkb,shstmsg,endistab,hostflg,denyflg>
  3149.         stent   <srchkb,sdelmsg,endistab,delflg,denyflg>
  3150.         stent   <srchkb,ssndmsg,endistab,sndflg,denyflg>
  3151.         stent   <srchkb,sdirmsg,endistab,dirflg,denyflg>
  3152.         stent   <srchkb,sspcmsg,endistab,spcflg,denyflg>
  3153.         stent   <srchkb,sfinmsg,endistab,finflg,denyflg>
  3154.         stent   <srchkb,stypmsg,endistab,typflg,denyflg>
  3155.         stent   <srchkb,sgetmsg,endistab,getsflg,denyflg>
  3156.         dw      0
  3157. stserv2 stent   <stnum,srvmsg,,srvtmo>
  3158.         dw      0
  3159. stterm  stent   <srchkw,vtemst,termtb,flags.vtflg>      ; SHOW TERMINAL
  3160.         stent   <srchkb,stekmsg,endistab,tekxflg,denyflg>
  3161.         stent   <onechr,escmes,,trans.escchr>
  3162.         stent   <srchkw,modst,modtab,flags.modflg>
  3163.         stent   <vtstat>
  3164.         dw      0
  3165. datas   ends
  3166.  
  3167. if1
  3168.         %out [End of pass 1]
  3169. else
  3170.         %out [End of assembly]
  3171. endif
  3172.         end
  3173.